Loading data from yml file, checking all available paths.

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

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

    HouseMD

    So so far i have this:
    Code:
    public class Load {
     
        private static Set<String> w = new HashSet<String>();
        private static Set<String> a = new HashSet<String>();
     
        public static void getWorlds() {
     
            w = GGCPlugin.GameSettings.getConfigurationSection("Arenas.Worlds")
                    .getKeys(false);
     
            Bukkit.broadcastMessage("World List: " + w);
     
        }
     
        public static void getArenas() {
     
            for (String s : w) {
                a.addAll(GGCPlugin.GameSettings.getConfigurationSection(
                        "Arenas.Worlds" + s).getKeys(false));
            }
     
            Bukkit.broadcastMessage("Arena List: " + a);
     
        }
       
        public static void loadArenas() {
            getWorlds();
            getArenas();
        }
     
    }
    I really cant explain that well what i'm trying to do but its pretty obvious after you read that little code.

    My yml file looks like this:

    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 im trying to read all available worlds in the file (in this case only one "world") and then get all arenas in "world" or even any other path if there are more worlds present.

    However i get an error when i run the command.
     
  2. Offline

    stelar7

    you forgot a .
    "Arenas.Worlds(. goes here)"+s
     
    HouseMD likes this.
Thread Status:
Not open for further replies.

Share This Page