Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.NathanTheDragon.sethealth;
- import java.util.logging.Logger;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.PluginDescriptionFile;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.potion.PotionEffectType;
- public class SetHealth extends JavaPlugin
- {
- public final Logger logger = Logger.getLogger("Minecraft");
- public static SetHealth plugin;
- public void onDisable()
- {
- PluginDescriptionFile pdfFile = this.getDescription();
- this.logger.info("[" + pdfFile.getName() + "]" + " has been Disabled! Why u leave me D:!");
- }
- public void onEnable()
- {
- PluginDescriptionFile pdfFile = this.getDescription();
- this.logger.info("[" + pdfFile.getName() + "]" + " Version " + pdfFile.getVersion() + " has successfully been Enabled! Awesome!");
- }
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
- {
- Player player = (Player) sender;
- if (args.length == 0)
- {
- if (cmd.getName().equalsIgnoreCase("heal") && player.hasPermission("sethealth.heal"))
- {
- player.setHealth(20);
- player.setFireTicks(0);
- player.setFoodLevel(20);
- player.sendMessage(ChatColor.WHITE + "[" + ChatColor.GREEN + "Health" + ChatColor.WHITE + "]" + ChatColor.GOLD + " " + ChatColor.BOLD + "You have been healed!");
- return true;
- }
- if(cmd.getName().equalsIgnoreCase("feed") && player.hasPermission("sethealth.feed"))
- {
- player.setFoodLevel(20);
- player.removePotionEffect(PotionEffectType.HUNGER);
- player.sendMessage(ChatColor.WHITE + "[" + ChatColor.GREEN + "Health" + ChatColor.WHITE + "]" + ChatColor.GOLD + " " + ChatColor.BOLD + "You have been fed!");
- return true;
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement