From d0cd8c6cc7d1aaf38934996e7e5d3e03272e4ff1 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sun, 30 Jan 2011 01:26:45 -0800 Subject: [PATCH] Fixed drowning damage event. --- .../java/net/minecraft/server/EntityLiving.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index dc8f462038..17d62bee05 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -167,7 +167,19 @@ public abstract class EntityLiving extends Entity { this.l.a("bubble", p + (double) f1, q + (double) f2, r + (double) f3, this.s, t, u); } - a(((Entity) (null)), 2); + // CraftBukkit start + CraftServer server = ((WorldServer) l).getServer(); + org.bukkit.entity.Entity damagee = this.getBukkitEntity(); + DamageCause damageType = EntityDamageEvent.DamageCause.DROWNING; + int damageDone = 2; + + EntityDamageEvent ede = new EntityDamageEvent(damagee, damageType, damageDone); + server.getPluginManager().callEvent(ede); + + if (!ede.isCancelled()){ + a(((Entity) (null)), ede.getDamage()); + } + // CraftBukkit end } Z = 0; } else {