diff options
author | feildmaster <admin@feildmaster.com> | 2012-03-12 17:55:02 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-03-15 05:11:48 -0400 |
commit | 45031672838e5686bb3dbb8909f2fdc5b40d6106 (patch) | |
tree | b055bc07ec76c08f9866fe6a14cb72955d921cf1 /src/main/java/net/minecraft/server/EntitySmallFireball.java | |
parent | c625d00351f3c9c7042c8e391d76e333d57bd04a (diff) | |
download | craftbukkit-45031672838e5686bb3dbb8909f2fdc5b40d6106.tar craftbukkit-45031672838e5686bb3dbb8909f2fdc5b40d6106.tar.gz craftbukkit-45031672838e5686bb3dbb8909f2fdc5b40d6106.tar.lz craftbukkit-45031672838e5686bb3dbb8909f2fdc5b40d6106.tar.xz craftbukkit-45031672838e5686bb3dbb8909f2fdc5b40d6106.zip |
Fixed EntityDamageByEntityEvent to call for every attackable entity. Fixes BUKKIT-1129, Fixes BUKKIT-1054 and Fixes BUKKIT-147.
Diffstat (limited to 'src/main/java/net/minecraft/server/EntitySmallFireball.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntitySmallFireball.java | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/src/main/java/net/minecraft/server/EntitySmallFireball.java b/src/main/java/net/minecraft/server/EntitySmallFireball.java index 6f632700..6cd2008c 100644 --- a/src/main/java/net/minecraft/server/EntitySmallFireball.java +++ b/src/main/java/net/minecraft/server/EntitySmallFireball.java @@ -1,12 +1,6 @@ package net.minecraft.server; -// CraftBukkit start -import org.bukkit.Bukkit; -import org.bukkit.entity.Projectile; -import org.bukkit.event.entity.EntityCombustByEntityEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.plugin.PluginManager; -// CraftBukkit end +import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit public class EntitySmallFireball extends EntityFireball { @@ -27,26 +21,14 @@ public class EntitySmallFireball extends EntityFireball { protected void a(MovingObjectPosition movingobjectposition) { if (!this.world.isStatic) { - // CraftBukkit start - projectile hit event - Projectile projectile = (Projectile) this.getBukkitEntity(); - ProjectileHitEvent phe = new ProjectileHitEvent(projectile); - final PluginManager pluginManager = Bukkit.getPluginManager(); - pluginManager.callEvent(phe); - // CraftBukkit end - final Entity movingEntity = movingobjectposition.entity; - if (movingEntity != null) { - // CraftBukkit start - entity damage by entity event + combust event - if (!movingEntity.isFireproof()) { // check if not fireproof - org.bukkit.entity.Entity damagee = movingEntity.getBukkitEntity(); - - if (org.bukkit.craftbukkit.event.CraftEventFactory.handleProjectileEvent(projectile, movingobjectposition.entity, DamageSource.projectile(this, this.shooter), 0)) { - // if the fireball 'sticks', ignite the target - EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(projectile, damagee, 5); - pluginManager.callEvent(combustEvent); - - if (!combustEvent.isCancelled()) { - movingEntity.setOnFire(combustEvent.getDuration()); - } + if (movingobjectposition.entity != null) { + if (!movingobjectposition.entity.isFireproof() && movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5)) { + // CraftBukkit start - entity damage by entity event + combust event + EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5); + movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + movingobjectposition.entity.setOnFire(event.getDuration()); } // CraftBukkit end } |