Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  2.  
  3. if (cmd.getName().equalsIgnoreCase("teleportme") && sender instanceof Player) {
  4.  
  5. Player player = (Player) sender;
  6.  
  7. Location originalLocation = player.getLocation();
  8.  
  9. Random random = new Random();
  10.  
  11. int x = random.nextInt(1000) + 1;
  12. Block y = block;
  13. int z = random.nextInt(1000) + 1;
  14.  
  15. Block block = originalLocation.getWorld().getHighestBlockAt(x, z);
  16.  
  17. Location add(0, 1, 0)
  18.  
  19. Location teleportLocation = new Location(player.getWorld(), x, y, z);
  20.  
  21. player.teleport(teleportLocation);
  22.  
  23. player.sendMessage(ChatColor.GREEN + "You have been teleported " + (int)teleportLocation.distance(originalLocation) + " blocks away!");
  24.  
  25. return true;
  26. }
  27.  
  28. return false;
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement