3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/patches/server/0659-Make-EntityUnleashEvent-cancellable.patch
Nassim Jahnke 275173e538
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
0c5d8709 SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends
255c4fdb SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot

CraftBukkit Changes:
b6b514b7e SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends
fcff84de9 SPIGOT-7399: Revert null check in CraftMetaItem#safelyAdd
44a4b5649 SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot
676969d01 SPIGOT-7389: Handle setting null items in ChiseledBookshelf Inventory
2023-06-18 13:18:11 +02:00

42 Zeilen
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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);