Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. package me.jim.command;
  2.  
  3. import me.jim.utils.MessageUtils;
  4. import me.jim.utils.PingUtil;
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandExecutor;
  8. import org.bukkit.command.CommandSender;
  9. import org.bukkit.entity.Player;
  10.  
  11. /**
  12. * Created by Forge on 23/03/2017.
  13. */
  14. public class PingCommand implements CommandExecutor {
  15.  
  16.  
  17. public boolean onCommand(CommandSender sender, Command cmd, String string, String[] args) {
  18. if(cmd.getName().equalsIgnoreCase("ping"))
  19. if(args.length == 0)
  20. {
  21. Player p = (Player)sender;
  22. sender.sendMessage("Your Ping is " + PingUtil.getPing(p));
  23. }
  24. else if (Bukkit.getPlayer(args[0]) == null)
  25. {
  26. sender.sendMessage(MessageUtils.playerOffline);
  27. }
  28. else
  29. {
  30. Player p2 = Bukkit.getPlayer(args[0]);
  31. sender.sendMessage(p2 +"'s ping is " + PingUtil.getPing(p2));
  32. }
  33. return true;
  34. }
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement