Solved World loading - onEnable

Discussion in 'Plugin Development' started by RainoBoy97, Sep 30, 2013.

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

    RainoBoy97

    Hello! I'm working on a map/world management plugin, and ran across a problem.
    I am trying to load all the maps, and their respective configuration file. But it wont load all of them.

    onEnable:
    Code:
    int maps = MapManager.loadAllMaps();
    this.getLogger().info("Loaded " + maps + " maps!");
    
    MapManager.loadAllMaps() method:
    Code:
    public static int loadAllMaps() {
    int ret = 0;
    for (World w : Bukkit.getWorlds()) {
    worlds.put(w.getName(), new WorldCfg(w));
    ret++;
    }
    return ret;
    }
    
    This method always returns 1 when I'm enabling the plugin, and thats always the main world (world). Is this a bug? Or am I doing something completely wrong?

    Thanks - Raino!
     
  2. Offline

    MrSparkzz

    RainoBoy97
    It seems like it's only finding one world... Else it would add one for each additional world. Weird...
     
  3. Offline

    RainoBoy97

    MrSparkzz
    Yeah, and I really need it to work xD

    Bump! Anyone else that can see a problem/knows how to fix? I'm completely stuck at this :(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  4. Offline

    OptimalBread

    RainoBoy97 Did you figure it out because I am having the same problem too
     
  5. Offline

    WhatAaCow

    RainoBoy97 Have you tried to run the code 1 tick later?
     
  6. Offline

    RainoBoy97

    WhatAaCow likes this.
Thread Status:
Not open for further replies.

Share This Page