How to switch between multiple worlds?

Discussion in 'Plugin Development' started by lowlight, Dec 6, 2019.

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


    Imagine any minigame with a "lobby state", e.g. SurvivalGames.

    Is there a way to switch between a lobby world and the ingame map using multiple worlds (-> without teleporting players on one world to another location)?
  2. Offline


    Get the target world by name using Bukkit.getWorld("name") and create a new location, then teleport the player.
  3. Offline


    No. If they are on separate worlds, one must teleport between worlds. If you want to avoid that, I assume because of the time to transition worlds, then just make the lobby on the same world in a remote location.
  4. Offline


    @yPedx Thanks! Gonna try that tomorrow.

    @Strahan No I think yPedx's answer is the solution. I want to be to use multiple worlds (and not only one with multiple maps on it) because that makes it easier to add new maps. Thank you anyways

    @yPedx I'm not sure I understood your answer... I tried using the following code to teleport the player to another world on the server:

    if(Bukkit.getWorld("Test") != null) {
        player.teleport(new Location(Bukkit.getWorld("Test"), 0, 0, 0));
    } else
        player.sendMessage("§cDiese Welt existiert nicht!");
    However, Bukkit.getWorld() always returns null, even if the world "Test" exists in the server folder. Do I have to take any other steps for Bukkit to find the world, e.g. editing something in the file?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Dec 7, 2019
Thread Status:
Not open for further replies.

Share This Page