From cb5526fec284d7835a2cf83cd8a6dce83e6991b3 Mon Sep 17 00:00:00 2001
From: Tamion <70228790+notTamion@users.noreply.github.com>
Date: Sun, 21 Jul 2024 12:33:37 +0200
Subject: [PATCH] Fix EntityUnleashEvent cancellation on distance cause
 (#11131)

---
 patches/server/Expand-EntityUnleashEvent.patch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/patches/server/Expand-EntityUnleashEvent.patch b/patches/server/Expand-EntityUnleashEvent.patch
index 49262ea063..d25ae9f802 100644
--- a/patches/server/Expand-EntityUnleashEvent.patch
+++ b/patches/server/Expand-EntityUnleashEvent.patch
@@ -67,8 +67,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 -            entity.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(entity.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE));
 +            // Paper start - Expand EntityUnleashEvent
 +            final EntityUnleashEvent event = new EntityUnleashEvent(entity.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
++            if (!event.callEvent()) return;
 +            dropLeash = event.isDropLeash();
-+            event.callEvent();
 +            // Paper end - Expand EntityUnleashEvent
          }
          // CraftBukkit end