Config Help

Discussion in 'Plugin Development' started by HelGod, Dec 8, 2013.

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

    HelGod

    This is how my config looks like. Does anyone know how I can get both test and test2? I know you can do warps.testaccount.test and warps.testaccount.test2. I want to know how I can loop through the configurationsections and get test and test2
    Code:java
    1. warps:
    2. testaccount:
    3. test:
    4. x: 123.86839507140115
    5. y: 66.0
    6. z: -147.6631869106123
    7. pitch: 23.07815
    8. yaw: -15.718949
    9. world: world
    10. Test2:
    11. x: 125.25812331560793
    12. y: 66.0
    13. z: -147.32224844473888
    14. pitch: 19.511778
    15. yaw: -18.655962
    16. world: world
     
  2. Offline

    Wolfey

    I believe what you're looking for is this:
    Code:java
    1.  
    2. for(String str : config.getStringList("warps.testaccount")) {
    3. // This will return test and Test2
    4. }
    5.  
     
  3. Offline

    HelGod

  4. this should loop through the whole config:
    Code:java
    1.  
    2. for (String key : config.getKeys(true)){
    3. player.sendMessage(key + ": " + config.get(key));
    4. }
    5.  

    filexfritz had shown me this, what it does is sends the whole config to a player. but if your looking to loop through the config this does that.
     
Thread Status:
Not open for further replies.

Share This Page