Hey there, I was wondering how I can make a config file that looks like this: Code: Node1: - test1 - test2 Node2: - test1 - test2 And then get a list of Nodes and a list of the values inside a node. Any ideas? If possible, in a List or HashMap.
klosjaarrr Code:java private void addToList(String listName, Object whatIwantToSave){ //Create a methodList<String> curList = getConfig().getStringList(listName); //Create a variable of an existing listcurList.add(whatIWantToSave); //Add new stuff you want to save to the listgetConfig().set(listName, curList); //Update the current list by resetting itsaveConfig(); //Save it} //ExampleString jack; //few names hereString james;String paul; //Imagine you would want to save their names to a list called 'Names' //Call the methodaddToList("Names", jack);addToList("Names", james);addToList("Names", paul); //You could ofcourse use an array, or loop so you don't//have to copy every time
do config.set(YourArea, Arrays.asList(Object1,Object2,Object3)) to remove it set the area to null and to get the list do List(YourType) list = (Cast of YourType) config.getList(YourArea);