Yatopia/patches/server/0026-EMC-EntityAttackedEntityEvent.patch
2020-03-05 20:47:48 +01:00

34 lines
1.3 KiB
Diff

From 057e21f3562794b28990ba71720a3a9c70fad92f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 20 Dec 2017 21:42:45 -0500
Subject: [PATCH] EMC EntityAttackedEntityEvent
For when you need to know one Entity has attacked another entity
and that the damage event was not cancelled.
---
.../org/bukkit/craftbukkit/event/CraftEventFactory.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 1f5d15bb4..a27240181 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -999,7 +999,14 @@ public class CraftEventFactory {
callEvent(event);
if (!event.isCancelled()) {
+ // Paper start
+ if (damager != null && !com.destroystokyo.paper.event.entity.EntityAttackedEntityEvent.callEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, event.getFinalDamage())) {
+ event.setCancelled(true);
+ return event;
+ }
+ // Paper end
event.getEntity().setLastDamageCause(event);
+
}
return event;
--
2.25.1.windows.1