summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfeildmaster <admin@feildmaster.com>2011-10-03 03:40:42 -0500
committerfeildmaster <admin@feildmaster.com>2011-10-03 03:40:42 -0500
commit7668af15b03bdf64ec985320d5b4a0126a200390 (patch)
tree067417a115973a04d864b2a2bbb503702c0dce68
parent3b9aa445e911ac3791535ddcdb77e69effa199ce (diff)
downloadEssentials-7668af15b03bdf64ec985320d5b4a0126a200390.tar
Essentials-7668af15b03bdf64ec985320d5b4a0126a200390.tar.gz
Essentials-7668af15b03bdf64ec985320d5b4a0126a200390.tar.lz
Essentials-7668af15b03bdf64ec985320d5b4a0126a200390.tar.xz
Essentials-7668af15b03bdf64ec985320d5b4a0126a200390.zip
Fires an event before "killing."
Can be made cancel-able. Could also be written to add "suicide" (if sender == player)
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandkill.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java
index 03afeadc4..0b403ca7d 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java
@@ -23,6 +23,10 @@ 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;
+
p.setHealth(0);
sender.sendMessage(Util.format("kill", p.getDisplayName()));
}