Can I do this with the configuration?

Discussion in 'Plugin Development' started by MrZoraman, Jul 29, 2012.

  1. Offline

    MrZoraman

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    My config.yml looks like this:
    Code:
    MrZoraman:
      test:
        X: -8.077357984277798
        Y: 113.0
        Z: 222.48164483196538
        World: world
      second:
        X: -4.30676960160291
        Y: 109.5382691836773
        Z: 187.9282851197848
        World: world
    Is there a way I could get a container of whats under a certain path? For instance, I could give the path to 'MrZoraman' and a set of strings would be returned, with "test" and "second". I don't care about the data under those, just the paths to them. I hope that makes sense .-.

    The reason for this is so that the player 'MrZoraman' could type in a command and a list of whats under his name would be listed. I already have the code to form the list, I just need the container of things to list.
  2. Offline

    Firefly

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I believe its config.getConfigurationSection("MrZoraman", false);
  3. Offline

    MrZoraman

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    There isn't a getConfigurationSection method that takes two arguments. Only one, which takes in the path, so I use config.getConfigurationSection("MrZoraman") but I'm not sure what to do from there. I also tried config.getConfigurationSection("MrZoraman").getStringList("MrZoraman") and config.getStringList("MrZoraman"). None of them returned a list with anything in it.
  4. Offline

    sd5

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    You can get the keys of a section with:
    Code:
    config.getConfigurationSection("MrZoraman").getKeys(true);
    Then you could pass through a loop and read all the values of the keys to a list...
  5. Offline

    Firefly

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    That's what I was thinking of with the children boolean.
  6. Offline

    MrZoraman

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Thank you very much for your help guys. That is exactly what I needed. :)

Share This Page