From e0cae289c4109b4d3d61fcfae10ed257452362c6 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 5 Jul 2020 02:25:29 -0400 Subject: [PATCH] Fix anvils bug - Fixes #3802 --- .../0535-Add-PrepareResultEvent.patch | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Spigot-Server-Patches/0535-Add-PrepareResultEvent.patch b/Spigot-Server-Patches/0535-Add-PrepareResultEvent.patch index e2b19f1be5..169422c902 100644 --- a/Spigot-Server-Patches/0535-Add-PrepareResultEvent.patch +++ b/Spigot-Server-Patches/0535-Add-PrepareResultEvent.patch @@ -107,21 +107,24 @@ index 270bf7f3e6ca15891419f1ce3e88d9aff094bee6..ce63c715e4920ad272e7c3dffb8f3279 private void a(IInventory iinventory, ItemStack itemstack) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 6c5036b23a41769167fd53b8cc5454e5e747598e..7a55bc4796317976e05eb53535eb420eed51e9c6 100644 +index 6c5036b23a41769167fd53b8cc5454e5e747598e..3e51d78b5b6b6b78381c36ca45a5166cd474df75 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1548,12 +1548,30 @@ public class CraftEventFactory { +@@ -1548,12 +1548,31 @@ public class CraftEventFactory { return event; } - public static PrepareAnvilEvent callPrepareAnvilEvent(InventoryView view, ItemStack item) { +- PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item).clone()); +- event.getView().getPlayer().getServer().getPluginManager().callEvent(event); ++ // Paper start - disable this method, handled below + public static void callPrepareAnvilEvent(InventoryView view, ItemStack item) { // Paper - verify nothing uses return - handled below in PrepareResult -+ if (true) return; // Paper - nothing - PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item).clone()); - event.getView().getPlayer().getServer().getPluginManager().callEvent(event); ++ PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item)); // Paper - remove clone ++ //event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // disable event event.getInventory().setItem(2, event.getResult()); + //return event; // Paper + } ++ // Paper end + + // Paper start - support specific overrides for prepare result + public static com.destroystokyo.paper.event.inventory.PrepareResultEvent callPrepareResultEvent(InventoryView view, ItemStack item, int resultSlot) {