mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2025-08-31 22:30:15 +00:00
Made setHealth(0) trigger EntityDeathEvent and drops. Thanks yetanotherx!
This commit is contained in:
parent
309846d732
commit
3439b7f9d9
1 changed files with 5 additions and 0 deletions
|
@ -6,6 +6,7 @@ import net.minecraft.server.EntityArrow;
|
||||||
import net.minecraft.server.EntityEgg;
|
import net.minecraft.server.EntityEgg;
|
||||||
import net.minecraft.server.EntityLiving;
|
import net.minecraft.server.EntityLiving;
|
||||||
import net.minecraft.server.EntitySnowball;
|
import net.minecraft.server.EntitySnowball;
|
||||||
|
import net.minecraft.server.EntityPlayer;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
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");
|
throw new IllegalArgumentException("Health must be between 0 and 200");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entity instanceof EntityPlayer && health == 0) {
|
||||||
|
((EntityPlayer)entity).a((Entity)null);
|
||||||
|
}
|
||||||
|
|
||||||
getHandle().health = health;
|
getHandle().health = health;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue