3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 07:10:10 +01:00

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.
Dieser Commit ist enthalten in:
t00thpick1 2013-12-09 23:03:13 -05:00 committet von Nate Mortensen
Ursprung c2a0396af2
Commit 1154484815

Datei anzeigen

@ -389,7 +389,10 @@ public class CraftEventFactory {
} }
public static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, float damage) { 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(); Entity damager = source.getEntity();
DamageCause cause = DamageCause.ENTITY_ATTACK; DamageCause cause = DamageCause.ENTITY_ATTACK;