Advertisement
Guest User

Untitled

a guest
Mar 14th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. package commands;
  2.  
  3. import java.util.HashMap;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.ChatColor;
  7. import org.bukkit.Location;
  8. import org.bukkit.command.Command;
  9. import org.bukkit.command.CommandExecutor;
  10. import org.bukkit.command.CommandSender;
  11. import org.bukkit.entity.Player;
  12.  
  13. public class tpatest implements CommandExecutor {
  14.  
  15. HashMap<Integer, Player> targettemp = new HashMap<Integer, Player>();
  16. HashMap<Integer, Location> loctemp = new HashMap<Integer, Location>();
  17.  
  18. @Override
  19. public boolean onCommand(CommandSender sender, Command command, String label, String[] args){
  20. if(label.equalsIgnoreCase("tprequest") && sender instanceof Player){
  21. Player player = (Player)sender;
  22. if(player.hasPermission("tpa")){
  23. if(args.length == 0){
  24. player.sendMessage(ChatColor.DARK_RED + "Not enough arguments.");
  25. }else if(args.length ==1){
  26. Player target = Bukkit.getPlayer(args[0]);
  27. if(target != null){
  28. player.sendMessage("tou tried to tp");
  29. target.sendMessage("someone tried to tp to you");
  30. targettemp.put(1, target);
  31. targettemp.put(2, player);
  32. return true;
  33. }else{
  34. player.sendMessage(ChatColor.DARK_RED + "Target is not online.");
  35. return false;
  36. }
  37. }return false;
  38. }return false;
  39. }else if(label.equalsIgnoreCase("tpaccept")){
  40. if(args.length == 0){
  41. Player player = targettemp.get(2);
  42. Player target = targettemp.get(1);
  43. Location location = target.getLocation(loctemp.get(1));
  44. player.teleport(location);
  45. target.sendMessage("someone tped");
  46. player.sendMessage("you tped!");
  47. return true;
  48. }return false;
  49. }
  50. return false;
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement