diff options
author | t00thpick1 <t00thpick1dirko@gmail.com> | 2013-12-09 23:03:13 -0500 |
---|---|---|
committer | Nate Mortensen <nate.richard.mortensen@gmail.com> | 2013-12-13 20:05:36 -0700 |
commit | 1154484815d665a8103763a6e4e1bc7811f8f592 (patch) | |
tree | 8a68a501a3d24c67ff55ca3f390dba55d8f84461 /src/main/java/org | |
parent | c2a0396af25caf14a3e499e6fb3e0077b60149a4 (diff) | |
download | craftbukkit-1154484815d665a8103763a6e4e1bc7811f8f592.tar craftbukkit-1154484815d665a8103763a6e4e1bc7811f8f592.tar.gz craftbukkit-1154484815d665a8103763a6e4e1bc7811f8f592.tar.lz craftbukkit-1154484815d665a8103763a6e4e1bc7811f8f592.tar.xz craftbukkit-1154484815d665a8103763a6e4e1bc7811f8f592.zip |
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.
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 902aa88b..a654a3e6 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; |