#1362: Include Creeper igniter in causing entity for damage events

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot
2024-04-07 11:49:28 +10:00
parent 779b5137f8
commit 84d43ef379
3 changed files with 24 additions and 13 deletions

View File

@@ -940,7 +940,7 @@ public class CraftEventFactory {
private static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions, boolean cancelled) {
CraftDamageSource bukkitDamageSource = new CraftDamageSource(source);
Entity damager = source.getCausingEntity();
Entity damager = (bukkitDamageSource.isIndirect() && source.getDirectEntity() != null) ? source.getDirectEntity() : source.getCausingEntity();
if (source.is(DamageTypeTags.IS_EXPLOSION)) {
if (damager == null) {
return callEntityDamageEvent(source.getDirectBlock(), entity, DamageCause.BLOCK_EXPLOSION, bukkitDamageSource, modifiers, modifierFunctions, cancelled);
@@ -950,10 +950,6 @@ public class CraftEventFactory {
} else if (damager != null || source.getDirectEntity() != null) {
DamageCause cause = (source.isSweep()) ? DamageCause.ENTITY_SWEEP_ATTACK : DamageCause.ENTITY_ATTACK;
if (bukkitDamageSource.isIndirect() && source.getDirectEntity() != null) {
damager = source.getDirectEntity();
}
if (damager instanceof IProjectile) {
if (damager.getBukkitEntity() instanceof ThrownPotion) {
cause = DamageCause.MAGIC;