On memorysections..

Discussion in 'Plugin Development' started by VoidWhisperer, Aug 12, 2012.

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

    VoidWhisperer

    It seems, atleast by my code, that if you try to do FileConfiguration.getConfigurationSection("text"), which it inherits from memorysection, unless it has keys, it returns null. am I doing something wrong or is there a way around this?
     
  2. True.

    You can use createSection("text").
    Here's the documentation:
    http://jd.bukkit.org/apidocs/org/bu...ySection.html#createSection(java.lang.String)

    It says old values will be "orphaned". I think that's good haha.
    Otherwise, add a check like.
    Code:
    MemorySection text = config.getConfigurationSection("text");
    if(text == null) {
        text = config.createSection("text");
    }
    By the way, are you sure you want to use FileConfiguration? Why not YamlConfiguration like usual?
    Look here: http://wiki.bukkit.org/Introduction_to_the_New_Configuration
     
Thread Status:
Not open for further replies.

Share This Page