World Jumping

Discussion in 'Plugin Development' started by Xerfox, Oct 28, 2013.

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

    Xerfox

    I was wondering how I can get a world even if the player isn't in it, and then telelport them to specific coordinates inside that world
    I know how to teleport them, but if they aren't in the world I want, then they will just end up in the middle of no where

    P.S.(No need for config, because this is a private plugin for a server :p)



    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String CommandLabel, String args[]){
    2. Player player = (Player) sender;
    3. if(CommandLabel.equalsIgnoreCase("hub")){
    4. player.teleport(new Location(player.getWorld(),-208.39880,108,98.90151));
    5. player.sendMessage(ChatColor.GREEN + "[" + ChatColor.BLUE + ChatColor.BOLD + "CrafterScape" + ChatColor.GREEN + "]" + ChatColor.BLUE + " Welcome to the Hub!");
    6. }
    7.  
    8. return true;
    9. }
    10.  
    11. }
     
  2. Offline

    1Rogue

    Code:java
    1. Bukkit.getWorld("worldname");
    2. Bukkit.getWorld(/* UUID */);
     
  3. Offline

    The_Doctor_123

    You can get a world by it's name like so:
    Code:java
    1. Bukkit.getWorld("SomeRandomWorld")

    EDIT: Ninja'd.. J:
     
    Shzylo likes this.
Thread Status:
Not open for further replies.

Share This Page