Dear, Ive been trying and searching for how i set, add and remove lines from a list in the config. Ive tried doing stuff like words.set(1, "hi"); etc.. But nothing works, ALWAYS returns just one huge error this is what i have now: (Part of my plugin) Code:java List<String> words = this.getConfig().getStringList(args[1]);if(line > words.size()){sender.sendMessage("&4" + line + " is out of range! " + args[1] + " only has " + words.size() + " lines");return true;}String text = "";for(int a = 3; a > args.length; a++){text += args[a] + " ";}words.set(line, text);this.getConfig().set(args[1], words);saveConfig();sender.sendMessage("&4" + args[1] + " succesfully updated!");return true;
Well, that "huge error" is your key to success. Because it doesn't only tell you THAT something is not working, it even tells you WHAT is not working. Check out this post - it explains very well how to read a stacktrace: http://forums.bukkit.org/threads/ho...ubleshoot-your-own-plugins-by-yourself.32457/ If you still can't figure it out after reading that - post your error here. Maybe we can help you then
Ridan This is how you add to the list. You can use the same idea to remove from the list. Code:java List<String> list = getConfig().getStringList("some.list"); list.add(someValue); getConfig().set("some.path", list);
Thanks, already helped me alot. But, how can i "edit" a line in the list? That would help me alot Thanks, - Ridan