--- a/net/minecraft/server/EntitySmallFireball.java +++ b/net/minecraft/server/EntitySmallFireball.java @@ -1,5 +1,7 @@ package net.minecraft.server; +import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit + public class EntitySmallFireball extends EntityFireballFireball { public EntitySmallFireball(EntityTypes entitytypes, World world) { @@ -8,6 +10,11 @@ public EntitySmallFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) { super(EntityTypes.SMALL_FIREBALL, entityliving, d0, d1, d2, world); + // CraftBukkit start + if (this.shooter != null && this.shooter instanceof EntityInsentient) { + isIncendiary = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING); + } + // CraftBukkit end } public EntitySmallFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) { @@ -23,7 +30,16 @@ if (!entity.isFireProof()) { int i = entity.ad(); - entity.setOnFire(5); + // CraftBukkit start - Entity damage by entity event + combust event + if (isIncendiary) { + EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), entity.getBukkitEntity(), 5); + entity.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + entity.setOnFire(event.getDuration(), false); + } + } + // CraftBukkit end boolean flag = entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F); if (flag) { @@ -32,11 +48,11 @@ entity.g(i); } } - } else if (this.shooter == null || !(this.shooter instanceof EntityInsentient) || this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) { + } else if (isIncendiary) { // CraftBukkit MovingObjectPositionBlock movingobjectpositionblock = (MovingObjectPositionBlock) movingobjectposition; BlockPosition blockposition = movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()); - if (this.world.isEmpty(blockposition)) { + if (this.world.isEmpty(blockposition) && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, this).isCancelled()) { // CraftBukkit this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); } }