Getting all keys from a specific path only?

Discussion in 'Plugin Development' started by HouseMD, Sep 28, 2012.

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

    HouseMD

    I save my data in this format:

    Code:
    Arenas:
      Worlds:
        world:
          Name:
            test2:
              Locations:
                l1:
                  X: 50
                  Y: 68
                  Z: 203
                l2:
                  X: 51
                  Y: 68
                  Z: 202
            test1:
              Locations:
                l1:
                  X: 46
                  Y: 68
                  Z: 206
                l2:
                  X: 47
                  Y: 68
                  Z: 205
    And i'm trying to get all, e.g worlds that are made (in this case one, "world").

    so i want to get all keys after "Arenas.Worlds" but not after the next key.

    so i don't want "Arenas.Worlds.world.Name.test1.Locations.ECT".
    all i want as an answer is "Arenas.Worlds.world".

    so far all i found was:

    Code:
    Set<String> a = GGCPlugin.GameSettings.getKeys(true);
    This gets all paths possible, e.g:

    Code:
    Arenas
    Arenas.Worlds
    Arenas.Worlds.world
    Arenas.Worlds.world.Name
    Arenas.Worlds.world.Name.test1
    Arenas.Worlds.world.Name.test1.Locations
     
  2. Offline

    LucasEmanuel

    Code:
    config.getConfigurationSection("Arenas.Worlds").getKeys(false))
     
  3. Offline

    HouseMD

    thanks :)
     
Thread Status:
Not open for further replies.

Share This Page