diff options
author | EvilSeph <evilseph@unaligned.org> | 2011-05-15 22:16:46 -0400 |
---|---|---|
committer | EvilSeph <evilseph@unaligned.org> | 2011-05-15 22:16:46 -0400 |
commit | 3439b7f9d93e612f4fedce40f587f609776e1df1 (patch) | |
tree | 9061518981c9aa99c80846cc56cf980fe22a255a | |
parent | 309846d732849b68e382c53bf3a0d7a6dfd82579 (diff) | |
download | craftbukkit-3439b7f9d93e612f4fedce40f587f609776e1df1.tar craftbukkit-3439b7f9d93e612f4fedce40f587f609776e1df1.tar.gz craftbukkit-3439b7f9d93e612f4fedce40f587f609776e1df1.tar.lz craftbukkit-3439b7f9d93e612f4fedce40f587f609776e1df1.tar.xz craftbukkit-3439b7f9d93e612f4fedce40f587f609776e1df1.zip |
Made setHealth(0) trigger EntityDeathEvent and drops. Thanks yetanotherx!
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index bc1c293f..8e736c2c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -6,6 +6,7 @@ import net.minecraft.server.EntityArrow; import net.minecraft.server.EntityEgg; import net.minecraft.server.EntityLiving; import net.minecraft.server.EntitySnowball; +import net.minecraft.server.EntityPlayer; import org.bukkit.Location; import org.bukkit.craftbukkit.CraftServer; @@ -38,6 +39,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { throw new IllegalArgumentException("Health must be between 0 and 200"); } + if (entity instanceof EntityPlayer && health == 0) { + ((EntityPlayer)entity).a((Entity)null); + } + getHandle().health = health; } |