I am wondering if its possible to combine two strings that I have set -
What I am trying to do is for when the player types the command "/rules add Rule Goes Here" It will add the text "Rule Goes Here" to the config file as a list, the config file will look like this:
Rules:
Rule 1
Rule 2
The code that I am trying to use for the command is stated below:
if (args[0].equalsIgnoreCase("add"))
{
ArrayList<String[]> list1 = new ArrayList<String[]>();
List<String[]> c = plugin.getConfig().getList("rules");
c.list1.addAll(Arrays.asList(args));
return true;
}
The "plugin" is the main class of the plugin, so where everything gets fired up to use. And thats where the config is generated.
I have attempted to use this code that I had found on the bukkit forums -
plugin.getConfig().getList("rules").add(args);
But no luck as I got the error stating:
The method
add(capture#4-of ?)in the typeList<capture#4-of ?>is not applicable for the arguments (String[])
Now might be a stupid question to ask, and most likey is, but I am still a beginner of course. If you could please assist me with this, id be very grateful. Thank you!
plugin? And can you clarify "what the player inputs for the rule"cas aList<?>but the next line isc.list1.add. What are you trying to do here?