How do I create multiple worlds?

Discussion in 'Plugin Development' started by kaskoepoes112, Apr 16, 2014.

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

    kaskoepoes112

    So I've been working on this minigame.

    I try to explain it as best as I can:
    When a player joins a server, he has to wait until the countdown reaches 0 (like in most minigames), then it'll start. When the game is over the player will get kicked and the server will restart. Then it has to change worlds. For example, the first minigame map is called world1 and another minigame map is called world2. When the first minigame finishes (which is world1) the server should restart and when you join that server it should be the second minigame (world2). So it basicly has to load the new world (the server doesn't need to restart, if it's possible to change worlds without shutting down the server that would be great).

    Sorry if you don't understand it, English is my 2nd language.
     
  2. Offline

    MrInspector

    Can't you just use performCommand("world teleport world2"); (That isn't a real command, but just use it to teleport to another world depending on what the command of the plugin you're using, assuming that you're using a world creator plugin)
     
  3. Offline

    amhokies

    Seriously? You speak English better than 80% of native English speakers.
     
    clabe45, DoctorDark and Konkz like this.
  4. Offline

    kaskoepoes112


    I tried this before, but when you have a different world than your default world (the one in your server.propities file) and you try to teleport someone to that world you will get a null exception.

    I tried this:

    Code:java
    1. World minigameworld = Bukkit.getServer().getWorlds().get(0); // gets default world
    2. World minigameworld2 = Bukkit.getServer().getWorld("minigameworld2"); // probably not the smartest way of doing this, but I don't really understand the getWorld(UUID uid) method
    3.  
    4.  
    5. // command:
    6.  
    7. Player p = (Player) sender
    8. p.teleport(new Location(minigameworld2, x, y ,z));
    9.  


    'minigameworld2' = null right here, and when you do something like this
    Code:
    Bukkit.getServer().getWorlds()
    You will get a list which contains your default world, the Nether and the End of your default world. So is there a way to get a second world in that list?

    amhokies
    Thanks, I'm still very young and learning English, my goal is to speak English nearly as good as a native speaker when I'm older :).


    EDIT: forgot to tell, I'm not using a world creator plugin, is this necessary? If so, which plugin should I use for that?
     
  5. Offline

    MrInspector

    A world creator plugin would rather be much easier, I'd try MultiVerse (http://dev.bukkit.org/bukkit-plugins/multiverse-core/) check that out and tell me if it's good!
     
    kaskoepoes112 likes this.
  6. Offline

    kaskoepoes112

    MrInspector likes this.
  7. Offline

    MrInspector

    No problem! Good luck! :D
     
Thread Status:
Not open for further replies.

Share This Page