Guest User

Untitled

a guest
Aug 26th, 2014
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. package me.nitexx3.zitcrafttpa.commands;
  2.  
  3. import me.nitexx3.zitcrafttpa.Main;
  4.  
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandExecutor;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.entity.Player;
  9.  
  10. public class TpacceptCommand implements CommandExecutor {
  11.  
  12. Main plugin;
  13.  
  14. public TpacceptCommand(Main plugin){
  15. this.plugin = plugin;
  16. }
  17.  
  18. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
  19. if((sender instanceof Player)){
  20. Player p = (Player)sender;
  21. if(args.length == 0){
  22. Player other = (Player)this.plugin.tpaManager.getLastSenderByReceiver.get(p);
  23. if (other != null){
  24. if ((System.currentTimeMillis() - ((Long)this.plugin.tpaManager.lastSenderRequestTime.get(other)).longValue()) / 1000L <= 60L){
  25. this.plugin.tpaManager.acceptRequest(other, p);
  26. String otheraccept = this.plugin.getConfigManager().otheraccept;
  27. other.sendMessage(otheraccept.replaceAll("&", "§").replaceAll("{PLAYER}", p.getName()));
  28. String tp = this.plugin.getConfigManager().tp;
  29. other.sendMessage(tp.replaceAll("&", "§"));
  30. String tpaccept = this.plugin.getConfigManager().tpaccept;
  31. p.sendMessage(tpaccept.replaceAll("&", "§").replaceAll("{PLAYER}", other.getName()));
  32. this.plugin.TeleportPlayerWithDelay(other, p.getLocation());
  33. return true;
  34. }else{
  35. String notfound = this.plugin.getConfigManager().notfound;
  36. p.sendMessage(notfound.replaceAll("&", "§"));
  37. }
  38. }else{
  39. String notfound = this.plugin.getConfigManager().notfound;
  40. p.sendMessage(notfound.replaceAll("&", "§"));
  41. }
  42. }else{
  43. String tpacceptussage = this.plugin.getConfigManager().tpacceptussage;
  44. p.sendMessage(tpacceptussage.replaceAll("&", "§"));
  45. }
  46. }else{
  47. sender.sendMessage("Brak dostepu do tej komendy z poziomu konsoli.");
  48. }
  49. return false;
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment