Advertisement
Guest User

Untitled

a guest
Mar 26th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. package me.supertolerator.practice;
  2.  
  3. import org.bukkit.command.Command;
  4. import org.bukkit.command.CommandSender;
  5. import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.plugin.java.JavaPlugin;
  8.  
  9. public class PracticeClass1 extends JavaPlugin{
  10. public void onEnable()
  11. {
  12. getLogger().info("Plugin Enabled.");
  13. }
  14.  
  15. public void onDisable()
  16. {
  17. getLogger().info("Plugin Disabled.");
  18. }
  19.  
  20. public int getPing(Player player){
  21. return ((CraftPlayer) player).getHandle().ping;
  22. }
  23.  
  24. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
  25. if(cmd.getName().equalsIgnoreCase("ping")){
  26. if(sender instanceof Player){
  27. Player player = (Player) sender;
  28. player.sendMessage(player.getName());
  29. }
  30. }
  31. return false;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement