Advertisement
YouMineWeCraft

Untitled

Feb 15th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.10 KB | None | 0 0
  1. package me.NathanTheDragon.sethealth;
  2.  
  3. import java.util.logging.Logger;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.plugin.PluginDescriptionFile;
  9. import org.bukkit.plugin.java.JavaPlugin;
  10. import org.bukkit.potion.PotionEffectType;
  11.  
  12. public class SetHealth extends JavaPlugin
  13. {
  14.     public final Logger logger = Logger.getLogger("Minecraft");
  15.     public static SetHealth plugin;
  16.    
  17.     public void onDisable()
  18.     {
  19.             PluginDescriptionFile pdfFile = this.getDescription();
  20.             this.logger.info("[" + pdfFile.getName() + "]" + " has been Disabled! Why u leave me D:!");  
  21.     }
  22.    
  23.     public void onEnable()
  24.     {
  25.             PluginDescriptionFile pdfFile = this.getDescription();
  26.             this.logger.info("[" + pdfFile.getName() + "]" + " Version " + pdfFile.getVersion() + " has successfully been Enabled! Awesome!");
  27.     }
  28.    
  29.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
  30.     {
  31.         Player player = (Player) sender;
  32.         if (args.length == 0)
  33.         {
  34.                 if (cmd.getName().equalsIgnoreCase("heal") && player.hasPermission("sethealth.heal"))
  35.                 {
  36.                     player.setHealth(20);
  37.                     player.setFireTicks(0);
  38.                     player.setFoodLevel(20);
  39.                     player.sendMessage(ChatColor.WHITE + "[" + ChatColor.GREEN + "Health" + ChatColor.WHITE + "]" + ChatColor.GOLD + " " + ChatColor.BOLD + "You have been healed!");
  40.                    
  41.                     return true;
  42.                 }
  43.                 if(cmd.getName().equalsIgnoreCase("feed") && player.hasPermission("sethealth.feed"))
  44.                 {
  45.                     player.setFoodLevel(20);
  46.                     player.removePotionEffect(PotionEffectType.HUNGER);
  47.                     player.sendMessage(ChatColor.WHITE + "[" + ChatColor.GREEN + "Health" + ChatColor.WHITE + "]" + ChatColor.GOLD + " " + ChatColor.BOLD + "You have been fed!");
  48.                     return true;
  49.                 }
  50.         }
  51.         return false;
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement