Fix anvils bug - Fixes #3802

This commit is contained in:
Aikar 2020-07-05 02:25:29 -04:00
parent 4793f774c8
commit e0cae289c4
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
1 changed files with 8 additions and 5 deletions

View File

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