I want to create a /teleport comand to teleport the player to a location i define. please help me to find the method. is not the .setX or .setZ???? Sorry about my bad english :s Cumps My code, but dont work: Code: else if(cmd.getName().equalsIgnoreCase("teleport")){ Player player = (Player)sender; if(player.hasPermission("mcLEI.teleport")){ Location location = (Location) player.getLocation(); location.setX(-165); location.setY(62); location.setZ(212); location.setYaw(2); player.sendMessage(ChatColor.GOLD + "Todas as ferramentas foram adicionadas ao teu inventário"); return true; } player.sendMessage(ChatColor.GOLD + "Nao tens permissoes para tal"); return true; } return false;
You need to use teleport. Code:java else if(cmd.getName().equalsIgnoreCase("teleport")){Player player = (Player)sender;if(player.hasPermission("mcLEI.teleport")){Location location = player.getLocation(); pitch= player.getDirection().getPitch();yaw = player.getDirection.getYaw();player.teleport(location);player.setPitch(pitch); //Forgot the exact way to do thisplayer.setYaw(yaw);player.sendMessage(ChatColor.GOLD + "Todas as ferramentas foram adicionadas ao teu inventário");return true;}player.sendMessage(ChatColor.GOLD + "Nao tens permissoes para tal");return true;}return false; By the way, did you know this does absolutely nothing?
sorry about wrong forum. thanks all, i need to teleport player to X: -165 ; Y: 62; Z: 212 ; Yaw: 2 thanks about .teleport() method. i use a cast because my eclipse recommend Cumps