Hi, I didn't get it, how to do please ? I have that in config.yml (1st) and need to have that (2nd) Code:java Banned:- 'player1'- 'player2' Code:java Banned:- 'player1'- 'player2'- 'player3'- 'player4' And I don't know how to read such list Have I to do setString("Banned").getKey(true) ? And so what to do after that ? Thanks
List<String> yourlist = getConfig().getStringList("Path.To.Your.List"); this should help: http://wiki.bukkit.org/Configuration_API_Reference
Skionz I don't understand and can't fin the difference between the getConfig.getString("NormalPath.with.children") And the list Have I to do that ? Code:java getConfig().addStringList("Path.To.Your.List"); With "addStringList" ?
To175 Taken from the configuration API reference: Code:java // Setting a List of Strings// The List of Strings is first defined in this arrayList<String> listOfStrings = Arrays.asList("Hello World", "Welcome to Bukkit", "Have a Good Day!");this.getConfig().set("path.to.list", listOfStrings);
Monkey_Swag Thanks but I need to add elements, I don't want to set it. I have a huge list and I need to add elements.
Ok, thanks AdamQpzm so I have to do : Code:java List<String> list = getConfig().getList("path.to.list");list.add("to175"); ?
To175 As stated earlier, you get the list from the config, add your element to that list, then set that list again in the config.
AdamQpzm Maybe I can do that ? Code:java List<String> list = getConfig().getStringList("BannedPlayers");list.add(args[1]);