diff options
Diffstat (limited to 'patches/server/0686-Make-EntityUnleashEvent-cancellable.patch')
-rw-r--r-- | patches/server/0686-Make-EntityUnleashEvent-cancellable.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/patches/server/0686-Make-EntityUnleashEvent-cancellable.patch b/patches/server/0686-Make-EntityUnleashEvent-cancellable.patch new file mode 100644 index 0000000000..b16ad47f2f --- /dev/null +++ b/patches/server/0686-Make-EntityUnleashEvent-cancellable.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Sun, 3 Jan 2021 21:25:31 -0800 +Subject: [PATCH] Make EntityUnleashEvent cancellable + + +diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java +index e08d69af81f4ca0535be522eef4792e4127f454c..5fb88a3b7242a2712a568aaccebe601f89bfee3a 100644 +--- a/src/main/java/net/minecraft/world/entity/Mob.java ++++ b/src/main/java/net/minecraft/world/entity/Mob.java +@@ -1488,7 +1488,7 @@ public abstract class Mob extends LivingEntity { + if (flag1 && this.isLeashed()) { + // Paper start - drop leash variable + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN, true); +- this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit ++ if (!event.callEvent()) { return flag1; } + this.dropLeash(true, event.isDropLeash()); + // Paper end + } +diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java +index f5cb3576aa2560c86f4a1df9d51d8ecde4e98905..7b2a81f9a79c5e96beba44ffe9b56a305ac2404f 100644 +--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java ++++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java +@@ -51,7 +51,7 @@ public abstract class PathfinderMob extends Mob { + if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper + // Paper start - drop leash variable + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true); +- this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit ++ if (!event.callEvent()) { return; } + this.dropLeash(true, event.isDropLeash()); + // Paper end + } +@@ -63,7 +63,7 @@ public abstract class PathfinderMob extends Mob { + if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper + // Paper start - drop leash variable + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true); +- this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit ++ if (!event.callEvent()) return; + this.dropLeash(true, event.isDropLeash()); + // Paper end + this.goalSelector.disableControlFlag(Goal.Flag.MOVE); |