diff options
author | feildmaster <admin@feildmaster.com> | 2013-04-09 22:25:06 -0500 |
---|---|---|
committer | feildmaster <admin@feildmaster.com> | 2013-04-10 21:33:33 -0500 |
commit | 77d1524b3d11f2580cf5792a79cd4c72385fdee9 (patch) | |
tree | 0a8a817a20cde1904bd1894705d28434ad524350 /src/main/java/net/minecraft/server/Entity.java | |
parent | 535a85a5b0a25fdbce3a5ae8440d2c60f0fae6ee (diff) | |
download | craftbukkit-77d1524b3d11f2580cf5792a79cd4c72385fdee9.tar craftbukkit-77d1524b3d11f2580cf5792a79cd4c72385fdee9.tar.gz craftbukkit-77d1524b3d11f2580cf5792a79cd4c72385fdee9.tar.lz craftbukkit-77d1524b3d11f2580cf5792a79cd4c72385fdee9.tar.xz craftbukkit-77d1524b3d11f2580cf5792a79cd4c72385fdee9.zip |
Refactor EntityDamageEvents. Adds BUKKIT-1944 & BUKKIT-3684
Diffstat (limited to 'src/main/java/net/minecraft/server/Entity.java')
-rw-r--r-- | src/main/java/net/minecraft/server/Entity.java | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 7890d6f5..51a5b38c 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -24,7 +24,6 @@ import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageByBlockEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityPortalEvent; import org.bukkit.plugin.PluginManager; @@ -325,19 +324,7 @@ public abstract class Entity { } } else { if (this.fireTicks % 20 == 0) { - // CraftBukkit start - TODO: this event spams! - if (this instanceof EntityLiving) { - EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.FIRE_TICK, 1); - this.world.getServer().getPluginManager().callEvent(event); - - if (!event.isCancelled()) { - event.getEntity().setLastDamageCause(event); - this.damageEntity(DamageSource.BURN, event.getDamage()); - } - } else { - this.damageEntity(DamageSource.BURN, 1); - } - // CraftBukkit end + this.damageEntity(DamageSource.BURN, 1); } --this.fireTicks; @@ -790,20 +777,6 @@ public abstract class Entity { protected void burn(int i) { if (!this.fireProof) { - // CraftBukkit start - if (this instanceof EntityLiving) { - EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.FIRE, i); - this.world.getServer().getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return; - } - - i = event.getDamage(); - event.getEntity().setLastDamageCause(event); - } - // CraftBukkit end - this.damageEntity(DamageSource.FIRE, i); } } @@ -1594,14 +1567,11 @@ public abstract class Entity { } } - EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(stormBukkitEntity, thisBukkitEntity, EntityDamageEvent.DamageCause.LIGHTNING, 5); - pluginManager.callEvent(event); - + EntityDamageEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDamageEvent(entitylightning, this, EntityDamageEvent.DamageCause.LIGHTNING, 5); if (event.isCancelled()) { return; } - thisBukkitEntity.setLastDamageCause(event); this.burn(event.getDamage()); // CraftBukkit end |