diff options
author | sk89q <the.sk89q@gmail.com> | 2011-01-20 00:10:47 -0800 |
---|---|---|
committer | sk89q <the.sk89q@gmail.com> | 2011-01-20 02:10:31 -0800 |
commit | d3e8f792e5ce7c1f5125b31988bbdd7e34eec49f (patch) | |
tree | 3a26aa044b33e1c1d710f5cae7e94922bf813263 /src/main | |
parent | 11de6b91da38e3eb4e26f5da2aae7ba758567254 (diff) | |
download | craftbukkit-d3e8f792e5ce7c1f5125b31988bbdd7e34eec49f.tar craftbukkit-d3e8f792e5ce7c1f5125b31988bbdd7e34eec49f.tar.gz craftbukkit-d3e8f792e5ce7c1f5125b31988bbdd7e34eec49f.tar.lz craftbukkit-d3e8f792e5ce7c1f5125b31988bbdd7e34eec49f.tar.xz craftbukkit-d3e8f792e5ce7c1f5125b31988bbdd7e34eec49f.zip |
Added fall damage event.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityLiving.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 678debc0..ac33033c 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -7,6 +7,9 @@ import java.util.Random; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.entity.CraftLivingEntity; //CraftBukkit end +import org.bukkit.event.entity.EntityDamageByBlockEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; public abstract class EntityLiving extends Entity { @@ -420,7 +423,18 @@ public abstract class EntityLiving extends Entity { int k = (int) Math.ceil(f1 - 3F); if (k > 0) { - a(((Entity) (null)), k); + // CraftBukkit start + CraftServer server = ((WorldServer) l).getServer(); + org.bukkit.entity.Entity victim = this.getBukkitEntity(); + DamageCause damageType = EntityDamageEvent.DamageCause.FALL; + EntityDamageEvent evt = new EntityDamageEvent(victim, damageType, k); + server.getPluginManager().callEvent(evt); + // CraftBukkit end + + if (!evt.isCancelled()){ + a(((Entity) (null)), k); + } + int l = this.l.a(MathHelper.b(p), MathHelper.b(q - 0.20000000298023224D - (double) H), MathHelper.b(r)); if (l > 0) { |