Unable to get keys from configurationsection

Discussion in 'Plugin Development' started by Maximvdw, Mar 29, 2014.

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

    Maximvdw

    Hello,

    I have a problem when gettings keys from a configurationsection while using ConfigurationSerializable classes:

    Code:java
    1. /**
    2.   * Load all arenas
    3.   */
    4. public void loadArenas() {
    5. try {
    6. arenas = new ArrayList<Arena>(); // Clear list
    7. YamlConfiguration config = getArenaStorage().getStorage()
    8. .getConfig();
    9. if (config.getConfigurationSection("arenas") != null) {
    10. ConfigurationSection section = config
    11. .getConfigurationSection("arenas");
    12. for (String key : section.getKeys(false)) {
    13. SendConsole.info(key);
    14. }
    15. } else {
    16. SendConsole.info("No arena's found!");
    17. }
    18. } catch (Exception ex) {
    19. // Error while loading
    20. SendConsole.severe("Unable to load the arenas!");
    21. ex.printStackTrace();
    22. }
    23. }


    It does not give an error but the arena (ffa) does not get detected.
    The variable section is not null.

    Code:
    arenas:
      ffa:
        ==: MVdWPlugin.Arena
        maxPlayers: 0
        name: ffa
        minPlayers: 0
        spawns:
        - ==: MVdWPlugin.SerializableLocation
          yaw: -275.24893
          pitch: 25.049957
          z: -702.123444714781
          y: 5.0
          world: world
          x: -997.3375287720156
    
    Can someone help me?

    - Maximvdw

    I can confirm that it works when I remove the
    ==: MVdWPlugin.Arena line

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
Thread Status:
Not open for further replies.

Share This Page