See I know this might be a simple question with a simple answer but I have not found out how to do this.
Now, what I am trying to do is a fairly easy concept to understand it goes as such, I have my main configuration node, lets call it “test” for this purpose, on first server start up test is an empty node or non existent (still debating which one is better) and while server is running I am looking to add to that node, now not add to it by
getNode("test").setValue("test2");
because, if I understand how this works correctly, it would override all existing values. Now I know I could make this easier by making test2 have a value itself but there would be no point in my use.
So for those who have not understood what i am trying to do, here is a visual.
Config on first startup
Empty yes but once a command is executed such as /test add Test2
test{
Test2
}
and once another is ran such /test add Test3
test{
Test2,
Test3
}
Now I tried this:
//What my executor looks like
public class AddExecutor implements CommandExecutor{
private MainClass main;
public AddExecutor(MainClass main){
this.main = main;
}
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandExepction {
String input = args.<String>getOne("input").get();
if(main.rootNode().getNode("test").getChildrenList().contains(input)){
//Send error message
return CommandResult.success();
}
CommentedConfigurationNode node = main.rootNode().getNode("test");
String items = node.getString();
main.rootNode().getNode(node.getPath()).setValue(items + input);
//Send confirmation message
}
}
//rootNode() method in main class
public CommentedConfigurationNode rootNode(){
return configurationNode;
}
//configurationNode is set in main class so it there is no error there.
Above seemed to not effect the config at all. This should be easy to do but either my brain is stumped or there is someone other weird way to do this. So if anyone can solve my stupidity or help me with this problem it would be greatly appreciated.
P.S. ignore small typos, i did this purely in the web browser. 
