aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0660-Make-EntityUnleashEvent-cancellable.patch
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2023-06-12 16:51:45 -0700
committerGitHub <[email protected]>2023-06-12 16:51:45 -0700
commitc287e921a96438964f32f3c4e394d6809e0d06fa (patch)
treefcc826670454d8a8f5547838414583ce5f1df02d /patches/server/0660-Make-EntityUnleashEvent-cancellable.patch
parentb48e2e352e21c56d6a9e90bb8d9e548d3658a691 (diff)
downloadPaper-c287e921a96438964f32f3c4e394d6809e0d06fa.tar.gz
Paper-c287e921a96438964f32f3c4e394d6809e0d06fa.zip
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9301)1.20
Diffstat (limited to 'patches/server/0660-Make-EntityUnleashEvent-cancellable.patch')
-rw-r--r--patches/server/0660-Make-EntityUnleashEvent-cancellable.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/patches/server/0660-Make-EntityUnleashEvent-cancellable.patch b/patches/server/0660-Make-EntityUnleashEvent-cancellable.patch
new file mode 100644
index 0000000000..3d733321df
--- /dev/null
+++ b/patches/server/0660-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 1887b9cd309556eeacac2a5e5cd922560101fa72..b6e48531a2a1316eef786e0476574eb1c3c29a9e 100644
+--- a/src/main/java/net/minecraft/world/entity/Mob.java
++++ b/src/main/java/net/minecraft/world/entity/Mob.java
+@@ -1543,7 +1543,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
+ if (flag1 && this.isLeashed()) {
+ // Paper start - drop leash variable
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.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 a4dfe40d30a5abf5d614d0921b3b23023fdbc4b1..610bc67af915c8ff40a6c8a0d8e022e7db8614d8 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);