Config Stuff

Discussion in 'Plugin Development' started by crushh87, Apr 20, 2013.

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

    crushh87

    Heyo!

    So I'm trying to figure out how to loop through a config and get certain values.

    Lets Say I had something like this

    Code:
    Maps:
      Map1:
        Spawn.X: 123
        Spawn.Y: 1234
        Spawn.Z: 1234
      Map2:
        Spawn.X: 1233
        Spawn.Y: 12343
        Spawn.Z: 1746
    LastMap: Map1
    
    So As you see LastMap: Map1 so the next map should be Map2

    So what I'm asking is how could I loop through this check the LastMap then get the next map in the order and then get the values.

    I'm really confused on this subject, I have tried looking through the ConfigurationAPI thing and that has not helped much.

    If possible could you try and provide code with a walk through explaining the steps, as previously stated I'm really lost on this subject.

    Thanks!
     
  2. Offline

    chasechocolate

    Code:java
    1. for(String value : this.getConfig().getConfigurationSection("Maps").getKeys(false)){
    2. int x = this.getConfig().getInt("Maps." + value + ".x"); //Can't have a dot in a config variable, it will mess it up
    3. //Etc...
    4. }
     
Thread Status:
Not open for further replies.

Share This Page