From 1154484815d665a8103763a6e4e1bc7811f8f592 Mon Sep 17 00:00:00 2001 From: t00thpick1 Date: Mon, 9 Dec 2013 23:03:13 -0500 Subject: [PATCH] Do not fire EntityDamageEvent for explosions twice. Fixes BUKKIT-5156 Explosions directly caused by LivingEntities, such as creepers and tnt lit by players, have their EntityDamageEvent explicitely handled within the Explosion class. In order to prevent double events when damage is handled for other DamageSources, we need return null for explosion based damage sources. --- .../java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 902aa88be4..a654a3e605 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -389,7 +389,10 @@ public class CraftEventFactory { } public static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, float damage) { - if (source instanceof EntityDamageSource) { + // Should be isExplosion + if (source.c()) { + return null; + } else if (source instanceof EntityDamageSource) { Entity damager = source.getEntity(); DamageCause cause = DamageCause.ENTITY_ATTACK;