From 2b6c9f40aef19b5366a8ecd6bf2bb9900ce3c684 Mon Sep 17 00:00:00 2001 From: Lukas Hennig Date: Mon, 24 Apr 2017 18:20:14 +0200 Subject: Set health before entity death. --- src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 27cd0d43..5fbd1247 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -99,11 +99,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth() + "(" + health + ")"); } + getHandle().setHealth((float) health); + if (health == 0) { getHandle().die(DamageSource.GENERIC); } - - getHandle().setHealth((float) health); } public double getMaxHealth() { -- cgit v1.2.3