Advertisement
Guest User

Untitled

a guest
Oct 4th, 2015
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. package com.projectcraft.randomtp;
  2.  
  3. import java.util.Random;
  4.  
  5. import org.bukkit.Location;
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.plugin.java.JavaPlugin;
  10.  
  11. public class Main extends JavaPlugin{
  12.  
  13. public void OnEnable(){
  14. System.out.println("[RandomTP] Ativado");
  15.  
  16. }
  17.  
  18. public void OnDisable(){
  19. System.out.println("[RandomTP] Desabilitado");
  20.  
  21. }
  22. public boolean OnCommand(CommandSender sender, Command command, String label, String[] args){
  23. if (command.getName().equalsIgnoreCase("rtp")){
  24. if (!(sender instanceof Player)){
  25. sender.sendMessage("Voce nao pode usar este comando no console");
  26. return true;
  27. }
  28. Random random = new Random();
  29. Player p = (Player)sender;
  30. p.teleport(p.getWorld().getHighestBlockAt(random.nextInt(10000), random.nextInt(10000)).getLocation());
  31. Location location = p.getWorld().getHighestBlockAt(random.nextInt(1000), random.nextInt(10000)).getLocation();
  32. sender.sendMessage("Voce foi teleportado para um local aleatorio");
  33. while (location.getBlock().isLiquid());
  34. location = p.getWorld().getHighestBlockAt(random.nextInt(10000), random.nextInt(10000)).getLocation();
  35. return true;
  36.  
  37. }
  38.  
  39. return false;
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement