From 5a539a8bf52168276b065965acd8558be4236621 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sun, 19 Mar 2023 18:48:43 +1100 Subject: [PATCH] SPIGOT-7302: Fix more issues with EntityDamageByEntity - Fix Projectile damage by dispenser - Fix cases where only exists a direct entity damager By: Doc --- .../java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index f9a89dcfcd..7c412a1501 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -878,12 +878,15 @@ public class CraftEventFactory { entity.lastDamageCancelled = true; // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Keep track if the event was canceled } return event; - } else if (source.getEntity() != null) { + } else if (source.getEntity() != null || source.getDirectEntity() != null) { Entity damager = source.getEntity(); DamageCause cause = (source.isSweep()) ? DamageCause.ENTITY_SWEEP_ATTACK : DamageCause.ENTITY_ATTACK; if (source.isIndirect() && source.getDirectEntity() != null) { damager = source.getDirectEntity(); + } + + if (damager instanceof IProjectile) { if (damager.getBukkitEntity() instanceof ThrownPotion) { cause = DamageCause.MAGIC; } else if (damager.getBukkitEntity() instanceof Projectile) {