Solved How to read this from the config

Discussion in 'Plugin Development' started by Th3Controller, Jan 19, 2013.

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

    Th3Controller

    I've read from configs before I just don't know how to work this one out.

    The way I generate my configuration file is fairly simple.
    Code:
        public void onEnable() {
            getConfig().options().copyDefaults(true);
            saveConfig();
        }
    This is how I read from the configuration file.
    Code:
    List<Integer> disallowedblocks = plugin.getConfig().getIntegerList("disallowedblocks."+e.getPlayer().getWorld());
    This is my configuration file.
    Code:
    disallowedblocks:
      exampleworld:
      - '7'
      - '9'
    disallowedpickups:
      exampleworld:
      - '7'
      - '9'
     
  2. Offline

    t7seven7t

    So whats the problem? Stack trace? :3
     
  3. Offline

    Th3Controller

    No stacktrace amigo, I just need help reading from it.
     
  4. Offline

    Sagacious_Zed Bukkit Docs

    First you need to understand the type of the data stored in that yaml.
    Which specification can be found at http://yaml.org/spec/1.1/
     
  5. Offline

    Th3Controller

    *Jaw drops* Whoa, I just need a tiny help to read from the config. I can read from the config definitely, I just didn't learn how to read child nodes.
    Code:
    disallowedblocks:
      exampleworld:
      - '7'
     
  6. Offline

    Sagacious_Zed Bukkit Docs

    How is reading from a child node different than reading from a root node? (If you can answer this question, you have your answer)

    EDIT: the answer is also here http://wiki.bukkit.org/Configuration_API_Reference
     
  7. Offline

    Th3Controller

    I'm still accepting answers. Sagacious_Zed I've read that, :\
     
  8. Offline

    Sagacious_Zed Bukkit Docs

    You need to understand what type of data is at a particular path and how to read that particular path.
     
  9. Offline

    vYN

Thread Status:
Not open for further replies.

Share This Page