Fix EntityUnleashEvent cancellation on distance cause (#11131)

This commit is contained in:
Tamion 2024-07-21 12:33:37 +02:00
parent e09fea294f
commit cb5526fec2

View file

@ -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