Hello everyone. I plaining to make a multi-arena UHC plugin but I don't understand how to teleport someone in another world. If someone could explain me how to do this. Thanks.
to teleport someone somewhere you need to create an instance of Location to send them to Location lc=new Location(world, x, y, z); then call the Players teleport method giving it lc as the desternation pl.teleport(lc); this will teleport them to the new location on the other world since mc_1.5.1 there is a bug that causes the player to drop into the ground if their client hasnt alreadt got the chunk they are teleporting to already loaded, to fix this i schedule a delayed tast to repeat the teleport aproximatly 1 second after the teleport is first issued, by this time the chunk has loaded and they are put in the correct place another older bug i encountered was lr chunk not loading at all to fix this i used the fillowing code in my teleport plugin to force the chunk data to be sent to the client int x=lc.getChunk().getX(); int z=lc.getChunk().getZ(); pl.teleport(lc); lc.getWorld().loadChunk(x, z); lc.getWorld().refreshChunk(x,z); Hope this helps
Thank you for your answer. I write this on my own, eclipse don't see any error or warning but in game when i type the command /rush, i have an error. Code: public class CmdTeleport implements CommandExecutor { public CmdTeleport(Playervsplayer plugin) { } Logger log = Logger.getLogger("minecraft"); @Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ if(cmd.getName().equalsIgnoreCase("rush")){ Player player = (Player) sender; World p = Bukkit.getWorld("Rush"); player.teleport(new Location(p, -232, 51, -8.5)); return true; } return false; } } My main class : Code: package me.miffy.playervsplayer; import java.util.logging.Logger; import org.bukkit.plugin.java.JavaPlugin; public class Playervsplayer extends JavaPlugin{ Logger log = Logger.getLogger("minecraft"); @Override public void onEnable() { log.info("PlayerVsPlayer is now enabled !"); getCommand("rush").setExecutor(new CmdTeleport(this)); } @Override public void onDisable() { log.info("PlayerVsPlayer is now disabled !"); }