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.Bukkit;
- 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.PluginManager;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- public class SetHealth extends JavaPlugin{
- public final Logger logger = Logger.getLogger("Minecraft");
- public static SetHealth plugin;
- @Override
- public void onDisable() {
- PluginDescriptionFile pdfFile = this.getDescription();
- this.logger.info("[" + pdfFile.getName() + "]" + " has been Disabled! Why u leave me D:!");
- }
- @Override
- public void onEnable() {
- PluginDescriptionFile pdfFile = this.getDescription();
- this.logger.info("[" + pdfFile.getName() + "]" + " Version " + pdfFile.getVersion() + " has successfully been Enabled! Awesome!");
- }
- public final PluginManager pm = Bukkit.getServer().getPluginManager();
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
- Player player = (Player) sender;
- if (cmd.getName().equalsIgnoreCase("heal") || cmd.getName().equalsIgnoreCase("h")){
- if (player.hasPermission("sethealth.heal"))if (player.hasPermission("sethealth.*")) {
- if (args.length == 0) {
- player.setHealth(20);
- player.setFireTicks(0);
- player.setFoodLevel(20);
- for (PotionEffect effect : player.getActivePotionEffects())
- player.removePotionEffect(effect.getType());
- player.sendMessage(ChatColor.WHITE + "[" + ChatColor.GREEN + "Health" + ChatColor.WHITE + "]" + ChatColor.GOLD + " " + ChatColor.BOLD + "You have been healed!");;
- return true;
- }
- Player target = Bukkit.getServer().getPlayer(args[0]);
- if (target == null) {
- player.sendMessage(ChatColor.WHITE + "[" + ChatColor.GREEN + "Health" + ChatColor.WHITE + "]" + ChatColor.RED + " " + ChatColor.BOLD + "The Player isn't on the server!");
- return true;
- }
- target.setHealth(20);
- target.setFireTicks(0);
- target.setFoodLevel(20);
- for (PotionEffect effect : target.getActivePotionEffects())
- target.removePotionEffect(effect.getType());
- target.sendMessage(ChatColor.WHITE + "[" + ChatColor.GREEN + "Health" + ChatColor.WHITE + "]" + ChatColor.GOLD + " " + ChatColor.BOLD + "You have been healed by: " + ChatColor.RED + player.getName() + "!");
- player.sendMessage(ChatColor.WHITE + "[" + ChatColor.GREEN + "Health" + ChatColor.WHITE + "]" + ChatColor.GOLD + " " + ChatColor.BOLD + "You have healed: " + ChatColor.RED + target.getName() + "!");
- return true;}
- if(cmd.getName().equalsIgnoreCase("feed")){
- if (player.hasPermission("sethealth.feed"))if (player.hasPermission("sethealth.*")) {
- if (args.length == 0) {
- 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;
- }
- Player target = Bukkit.getServer().getPlayer(args[0]);
- if (target == null) {
- player.sendMessage(ChatColor.WHITE + "[" + ChatColor.GREEN + "Health" + ChatColor.WHITE + "]" + ChatColor.RED + " " + ChatColor.BOLD + "The Player isn't on the server!");
- return true;
- }
- target.setFoodLevel(20);
- target.removePotionEffect(PotionEffectType.HUNGER);
- target.sendMessage(ChatColor.WHITE + "[" + ChatColor.GREEN + "Health" + ChatColor.WHITE + "]" + ChatColor.GOLD + " " + ChatColor.BOLD + "You have been fed by: " + ChatColor.RED + player.getName() + "!");
- player.sendMessage(ChatColor.WHITE + "[" + ChatColor.GREEN + "Health" + ChatColor.WHITE + "]" + ChatColor.GOLD + " " + ChatColor.BOLD + "You have fed: " + ChatColor.RED + target.getName() + "!");
- return true;}
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement