Are Server.getWorlds() and Server.getWorld(String name) broken?

Discussion in 'Plugin Development' started by Olof Larsson, Apr 5, 2011.

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

    Olof Larsson

    Hello! :)
    I have tested this on different CraftBukkit builds since minecraft 1.4. I even just compiled and tried on the very latest commit (by Dinnerbone 2011-04-05 17:46:36).

    When using Server.getWorld(String name) I can only fetch the world "world". All other of my worlds return null. And Server.getWorlds() returns a list containing only the world "world" all my other worlds are missing.

    In fact I have three other worlds than "world".
    One called "netherworld" created by http://forums.bukkit.org/threads/tp-nether-v1-1-super-simple-nether-portals-531.4447/
    One called "aloria" created through this.getServer().createWorld("aloria", Environment.NORMAL);
    One called "nether" created through this.getServer().createWorld("nether", Environment.NETHER);

    I have also tested the command /world in Essentials 2.1.18. That plugin does not seem to be able to find my other worlds either.

    Now the solution is to do what this guy did:
    https://github.com/SpaceManiac/Nether/commit/f6a4352c2b6786a3e4260fbcdc277accf65a04d3#L0R32

    Code:
            // Load the world immediately
            if (getServer().getWorld(worldName) == null) {
                System.out.println("Nether is loading " + worldName + "...");
                getServer().createWorld(worldName, Environment.NETHER);
            }
    Should that really be necessary? @Dinnerbone
    Cake to those who fix this \^^/ [cake]
     
  2. Offline

    Drakia

    I looked at the CB code and the world is still being added to the worlds list, so I don't see why this wouldn't work.
    Using MultiVerse to load worlds, and server.getWorlds() results in all three of my loaded worlds being listed.
    Code:
    				for (World world : server.getWorlds()) {
    					log.info("World: " + world.getName());
    				}
     
Thread Status:
Not open for further replies.

Share This Page