Solved Teleport Player To Multiverse Generated World

Discussion in 'Spigot Plugin Development' started by PillBox_, Feb 14, 2020.

  1. I'm getting this error: https://pastebin.com/tgvG3gwp while trying to teleport the player to a world generated by Multiverse (Yes I did SoftDepend it).

    I've tried all sorts of ways of retrieving the world with to no avail. I'm using

    Code (Java):
    World w = Bukkit.getServer().getWorld("world");
          World d = Bukkit.getServer().getWorld("dungeons");
        // Adjust these values for teleport location(s).
          Location spawn = new Location(w, 0, 77, 0);
        Location easyTP = new Location(d, 0, 64, 0);
        Location medTP = new Location(d, 0, 80, 0);
        Location hardTP = new Location(d, 0, 80, 0);
        Location extrTP = new Location(d, 0, 80, 0);
        Location unbeaTP = new Location(d, 0, 80, 0);
    For TPing the player just using
    Code (Java):
    player.teleport(easyTP) // Example
    Any suggestions?
     
  2. Is the world loaded? From what i know to teleport a player to another world it must be loaded first,otherwise it will throw a null even though it exists in the files
     
  3. As the person above me asked, are you sure the world is loaded, can you teleport to it using multiverse? And is that the name of the folder for the world?
     
    #3 MartinOdum, Feb 14, 2020
    Last edited: Feb 14, 2020
  4. Yes, The world is loaded. I can use /mv tp <world> and I can also warp to the location using essentials.

    Yes the folder name for the world is "dungeons".
     
  5. Load the spawning chunk first before teleport I guess
     
  6. That is very odd, I doubt this is the issue but I normally do
    Code (Java):
    Bukkit.getWorld("worldname");
    As opposed to what you did which was include getServer() in there but anyway I also think this is a roundabout way of doing this but it will probably work, you could do this:

    Code (Java):
        public World MultiverseWorld(String worldname){
            for(World w : Bukkit.getWorlds()){
                if(w.getName().equals(worldname)){
                   return w;
                }
            }
            return null;
        }
    and then just do
    Code (Java):
    World d = MultiverseWorld("dungeons");
     
    • Agree Agree x 1
  7. At first I had it as just Bukkit.getWorld(). I guess I forgot to change it back. It had the same effect.


    This was the solution. A weird one but none-the-less the solution! Thanks!