Advertisement
Guest User

Untitled

a guest
Oct 6th, 2013
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. package me.Antonio.Test;
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. import org.bukkit.command.Command;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.plugin.PluginDescriptionFile;
  8. import org.bukkit.plugin.java.JavaPlugin;
  9.  
  10. public class Test extends JavaPlugin{
  11. public static Test plugin;
  12. public Logger logger = Logger.getLogger("Minecraft");
  13.  
  14. @Override
  15. public void onDisable(){
  16. PluginDescriptionFile pdfFile = this.getDescription();
  17. this.logger.info(pdfFile.getName() + " has been disabled");
  18.  
  19. }
  20.  
  21. @Override
  22. public void onEnable(){
  23. PluginDescriptionFile pdfFile = this.getDescription();
  24. this.logger.info(pdfFile.getName() + " has been enabled!");
  25. }
  26.  
  27. public boolean onCommand(Command sender, Command cmd, String commandLabel, String [] args){
  28. Player player = (Player) sender;
  29. if(commandLabel.equalsIgnoreCase("heal") || commandLabel.equalsIgnoreCase("h")){
  30. if (args.length == 0){
  31. player.setHealth(20.0);
  32. player.sendMessage("You healed yourself!");
  33. }else if (args.length == 1){
  34. if(player.getServer().getPlayer(args [0]) != null){
  35. Player targetPlayer = player.getServer().getPlayer(args [0]);
  36. targetPlayer.setHealth(20.0);
  37. targetPlayer.sendMessage("You were healed!");
  38. }else{
  39. player.sendMessage("Player is offline.");
  40. }
  41. }
  42. }
  43. return false;
  44. }
  45.  
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement