Yaml and Getting a list of "Keys"

Discussion in 'Plugin Development' started by Rza1337, Dec 3, 2011.

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

    Rza1337

    By "Keys" i actually mean paths, sorry.

    After spending hours trying to work this out, i put it to you people. Say i had a main path know as existing, but it had multiple paths within it, and each of them had their own variables. How would i go about getting the paths that exist under 'Areas' ?

    Code:
    Areas:
        'area1':
          x: 268.03125
          y: 80.0
          z: 284.5
          owner: 'null'
        'area2':
          x: 268.03125
          y: 80.0
          z: 284.5
          owner: 'null'
     
  2. Offline

    Sagacious_Zed Bukkit Docs

    @Rza1337
    Code:
    getConfig().getConfigurationSection("Areas."+(String area)).getKeys(false)
    which the String area is the area you are trying to look up.
     
  3. Offline

    Rza1337

    Thanks for the quick reply, but i'm not looking for a single area as such, rather return all of them in an array or list.
     
  4. Offline

    Sagacious_Zed Bukkit Docs

    @Rza1337
    you want a list of [x, y, z, owner, x,y,z, owner]?
     
  5. Offline

    Rza1337

    No, i am looking to get area1 and area2 in the example above, but in an array or list.
     
  6. Offline

    Sagacious_Zed Bukkit Docs

    You get a set of keys.
    Code:
    getConfig().getConfigurationSection("Areas").getKeys(false)
    now doesn't that code look so familiar....
     
  7. Offline

    Rza1337

    Familiar and similar to the last time :p

    its was
    +(String area)

    that threw me off.

    Thanks for your help :)
     
Thread Status:
Not open for further replies.

Share This Page