Fix EntityUnleashEvent cancellation on distance cause (#11131)

This commit is contained in:
Tamion 2024-07-21 12:33:37 +02:00 committed by GitHub
parent 3a47518b4b
commit aa36ae6576
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -41,7 +41,7 @@ index a46b7e09809937b6e09bc3e08760d34f6eb00c4d..e884f37137799c85e5acc410ae589636
}
diff --git a/src/main/java/net/minecraft/world/entity/Leashable.java b/src/main/java/net/minecraft/world/entity/Leashable.java
index 30d7dd9646ba9d6a9396dc140a61eb2cac07dfc6..674713a611e709542990f748027bdc5b800d6650 100644
index 30d7dd9646ba9d6a9396dc140a61eb2cac07dfc6..bc03f1fe2a311bf61449879751360c6775dde6ac 100644
--- a/src/main/java/net/minecraft/world/entity/Leashable.java
+++ b/src/main/java/net/minecraft/world/entity/Leashable.java
@@ -166,8 +166,11 @@ public interface Leashable {
@ -67,8 +67,8 @@ index 30d7dd9646ba9d6a9396dc140a61eb2cac07dfc6..674713a611e709542990f748027bdc5b
- 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