diff options
author | snowleo <schneeleo@gmail.com> | 2011-10-09 16:43:58 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-10-09 16:43:58 +0200 |
commit | 5984cd58356b554e19c1e0342f91f06508ecfdb6 (patch) | |
tree | 3fdf334e28ed59bd1aabc2ec1609f58bb5326dc8 | |
parent | 8fe08871410b07c2875e30a838a2de58269c8d0c (diff) | |
download | Essentials-5984cd58356b554e19c1e0342f91f06508ecfdb6.tar Essentials-5984cd58356b554e19c1e0342f91f06508ecfdb6.tar.gz Essentials-5984cd58356b554e19c1e0342f91f06508ecfdb6.tar.lz Essentials-5984cd58356b554e19c1e0342f91f06508ecfdb6.tar.xz Essentials-5984cd58356b554e19c1e0342f91f06508ecfdb6.zip |
Fix pull request of damage request
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandkill.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java index 0b403ca7d..e976faa42 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java @@ -4,6 +4,7 @@ import com.earth2me.essentials.Util; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageEvent; public class Commandkill extends EssentialsCommand @@ -23,10 +24,13 @@ public class Commandkill extends EssentialsCommand for (Player p : server.matchPlayer(args[0])) { - EntityDamageEvent ede = new EntityDamageEvent(p, EntityDamageEvent.DamageCause.CUSTOM, 1000); - server.getPluginManager().callEvent(ede); - //if (ede.isCancelled()) return; - + final EntityDamageEvent ede = new EntityDamageEvent(p, sender instanceof Player && ((Player)sender).getName().equals(p.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, 1000); + server.getPluginManager().callEvent(ede); + if (ede.isCancelled() && !sender.hasPermission("essentials.kill.force")) + { + continue; + } + p.setHealth(0); sender.sendMessage(Util.format("kill", p.getDisplayName())); } |