Implementation of reworked EntityCombustEvents

Also includes some extra comments, and a refactoring of the
PaintingBreakByEntity event that is raised when lighting strikes a painting.
This commit is contained in:
Andrew Ardill
2011-11-29 18:10:05 +11:00
parent 0c88f05c0d
commit 3da00ee41a
5 changed files with 46 additions and 34 deletions

View File

@@ -8,6 +8,7 @@ import org.bukkit.craftbukkit.entity.CraftItem;
import org.bukkit.craftbukkit.TrigMath;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.entity.EntityCombustByEntityEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityTargetEvent;
@@ -838,7 +839,12 @@ public abstract class EntityHuman extends EntityLiving {
int l = EnchantmentManager.c(this.inventory, (EntityLiving) entity);
if (l > 0) {
entity.j(l * 4);
// CraftBukkit start - raise a combust event when somebody hits with a fire enchanted item
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l*4);
if (!combustEvent.isCancelled()) {
entity.j(combustEvent.getDuration());
}
// CraftBukkit end
}
}