Load world from file?

Discussion in 'Plugin Development' started by Kepler_, Jul 1, 2013.

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

    Kepler_

    I have a world (world_lobby) in my server directory. I want to use that world on my server, but I can't figure out how.

    This is the code I have now to add the world, but it's not working. I have a custom world generator and I think that is overwriting the world.

    Code:
            WorldCreator wcLobby = new WorldCreator("world_lobby");
            wcLobby.environment(Environment.NORMAL);
            wcLobby.generateStructures(false);
            wcLobby.seed(0);
            wcLobby.generator(new LobbyChunkGenerator());
            lobby = Bukkit.createWorld(wcLobby);
            lobby.setStorm(false);
            Location lobbySpawn = Config.getLobbySpawn();
            lobby.setSpawnLocation((int)lobbySpawn.getX(), (int)lobbySpawn.getY(), (int)lobbySpawn.getZ());    
    How can I change this code so the world isn't regenerated? Thanks :D

    Edit:
    The folder with the world in my server directory is named world_lobby
     
  2. Offline

    Jogy34

    Well if you world folder is within another folder itself then the world name would be "outerFolder/world_lobby" I may be misunderstanding what your last comment meant though. I don't know why it would be regenerating your world but you could try using mcLobby.createWorld() as that's what I use to load my worlds in my plugins and it works fine. Also the WorldCreator methods are set up in a way that allows you to chain them together so you could do something like this if you wanted to:
    Code:
    WorldCreator wcLobby = new WorldCreator("world_lobby").environment(Environment.NORMAL).generateStructures(false).seed(0).generator(new LobbyChunkGenerator());
     
Thread Status:
Not open for further replies.

Share This Page