Config help

Discussion in 'Plugin Development' started by Areoace, Oct 8, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Areoace

    So I'm fairly new to configs and am wondering how to do things like adding strings and substrings e.g

    Groups:

    Groupname
    - Land: (X,Z),(X,Z) ext
    - Enemies: that
    - Allies: this
    - Members: me, you, Notch

    Groupname 2
    - Land:
    - Enemies, this, groupname
    - Allies:
    - Members rage

    Basically like a factions plugin
     
  2. Areoace

    If someone else has a better way than me, please share. That being said, what I do is I get the list from config. Then, I loop through all the strings, and split them.

    EX:

    Code:java
    1. List<String> list = plugin.getConfig().getStringList("Groups.GroupName");
    2. for(String s : list)
    3. {
    4. if(s.contains("Enemies:")
    5. {
    6.  
    7. s.replace("Enemies:", " ");
    8. String[] enemy = s.split(", ");
    9. String e = enemy[0];
    10.  
    11. }

    ^This was done without Eclipse, so it may not be perfect.
     
  3. Offline

    Areoace

    Sorry to be annoying, but to make a new config how would i do so :S e.g when someone makes a group for expample:

    /g make - it makes a config with the g name and has all the data stored
     
Thread Status:
Not open for further replies.

Share This Page