mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 01:06:01 +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. By: t00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
parent
b79e797434
commit
fcdf051fa5
1 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue