diff --git a/patches/api/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch b/patches/api/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch index 9395f0c46d..fcfb3b0570 100644 --- a/patches/api/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch +++ b/patches/api/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch @@ -17,8 +17,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.event.inventory; + -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.inventory.InventoryEvent; +import org.bukkit.inventory.GrindstoneInventory; +import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.ItemStack; @@ -27,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +/** + * Called when an item is put in a slot for grinding in a Grindstone -+ * @see com.destroystokyo.paper.event.inventory.PrepareResultEvent ++ * @deprecated use {@link org.bukkit.event.inventory.PrepareGrindstoneEvent} + */ +@Deprecated +public class PrepareGrindstoneEvent extends PrepareResultEvent { @@ -51,9 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.event.inventory; + -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.inventory.InventoryEvent; -+import org.bukkit.event.inventory.InventoryType; ++import org.bukkit.event.inventory.PrepareInventoryResultEvent; +import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; @@ -62,14 +58,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +/** + * Called when an item is put in an inventory containing a result slot + */ -+public class PrepareResultEvent extends InventoryEvent { -+ -+ private static final HandlerList handlers = new HandlerList(); -+ private ItemStack result; ++public class PrepareResultEvent extends PrepareInventoryResultEvent { + ++ // HandlerList on PrepareInventoryResultEvent to ensure api compat + public PrepareResultEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { -+ super(inventory); -+ this.result = result; ++ super(inventory, result); + } + + /** @@ -79,133 +72,125 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + @Nullable + public ItemStack getResult() { -+ return result; ++ return super.getResult(); + } + ++ /** ++ * Set result item, may be null. ++ * ++ * @param result result item ++ */ + public void setResult(@Nullable ItemStack result) { -+ this.result = result; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return handlers; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return handlers; ++ super.setResult(result); + } +} diff --git a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java +++ b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java -@@ -0,0 +0,0 @@ - package org.bukkit.event.inventory; - -+import com.destroystokyo.paper.event.inventory.PrepareResultEvent; - import org.bukkit.event.HandlerList; - import org.bukkit.inventory.AnvilInventory; - import org.bukkit.inventory.InventoryView; @@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; /** * Called when an item is put in a slot for repair by an anvil. */ --public class PrepareAnvilEvent extends InventoryEvent { -+// Paper start - extend PrepareResultEvent -+public class PrepareAnvilEvent extends PrepareResultEvent { +-public class PrepareAnvilEvent extends PrepareInventoryResultEvent { ++public class PrepareAnvilEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent { - private static final HandlerList handlers = new HandlerList(); -- private ItemStack result; -+ //private static final HandlerList handlers = new HandlerList(); -+ //private ItemStack result; ++ // Paper - move HandlerList to PrepareInventoryResultEvent public PrepareAnvilEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { -- super(inventory); -- this.result = result; -+ super(inventory, result); -+ //this.result = result; -+ // Paper end + super(inventory, result); +@@ -0,0 +0,0 @@ public class PrepareAnvilEvent extends PrepareInventoryResultEvent { + return (AnvilInventory) super.getInventory(); } - @NotNull -@@ -0,0 +0,0 @@ public class PrepareAnvilEvent extends InventoryEvent { - */ - @Nullable - public ItemStack getResult() { -- return result; -+ return super.getResult(); // Paper - } - - public void setResult(@Nullable ItemStack result) { -- this.result = result; -+ super.setResult(result); // Paper - } - -+ /* // Paper - comment out - @NotNull - @Override - public HandlerList getHandlers() { -@@ -0,0 +0,0 @@ public class PrepareAnvilEvent extends InventoryEvent { - public static HandlerList getHandlerList() { - return handlers; - } -+ */ // Paper +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - move HandlerList to PrepareInventoryResultEvent } +diff --git a/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java +@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; + /** + * Called when an item is put in a slot for repair or unenchanting in a grindstone. + */ +-public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent { ++public class PrepareGrindstoneEvent extends com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent { // Paper + +- private static final HandlerList handlers = new HandlerList(); ++ // Paper - move HandlerList to PrepareInventoryResultEvent + + public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { + super(inventory, result); +@@ -0,0 +0,0 @@ public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent { + return (GrindstoneInventory) super.getInventory(); + } + +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - move HandlerList to PrepareInventoryResultEvent + } +diff --git a/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java +@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; + + /** + * Called when an item is put in a slot and the result is calculated. ++ * @deprecated use {@link com.destroystokyo.paper.event.inventory.PrepareResultEvent} + */ ++@Deprecated // Paper + public class PrepareInventoryResultEvent extends InventoryEvent { + + private static final HandlerList handlers = new HandlerList(); diff --git a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java +++ b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java -@@ -0,0 +0,0 @@ - package org.bukkit.event.inventory; - -+import com.destroystokyo.paper.event.inventory.PrepareResultEvent; - import org.bukkit.event.HandlerList; - import org.bukkit.inventory.InventoryView; - import org.bukkit.inventory.ItemStack; @@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; /** * Called when an item is put in a slot for upgrade by a Smithing Table. */ --public class PrepareSmithingEvent extends InventoryEvent { -+// Paper start - extend PrepareResultEvent -+public class PrepareSmithingEvent extends PrepareResultEvent { +-public class PrepareSmithingEvent extends PrepareInventoryResultEvent { ++public class PrepareSmithingEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent { - private static final HandlerList handlers = new HandlerList(); -- private ItemStack result; -+ //private static final HandlerList handlers = new HandlerList(); -+ //private ItemStack result; ++ // Paper - move HandlerList ot PrepareInventoryResultEvent public PrepareSmithingEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { -- super(inventory); -- this.result = result; -+ super(inventory, result); -+ //this.result = result; -+ // Paper end + super(inventory, result); +@@ -0,0 +0,0 @@ public class PrepareSmithingEvent extends PrepareInventoryResultEvent { + return (SmithingInventory) super.getInventory(); } - @NotNull -@@ -0,0 +0,0 @@ public class PrepareSmithingEvent extends InventoryEvent { - */ - @Nullable - public ItemStack getResult() { -- return result; -+ return super.getResult(); // Paper - } - - public void setResult(@Nullable ItemStack result) { -- this.result = result; -+ super.setResult(result); // Paper - } - -+ /* // Paper - comment out - @NotNull - @Override - public HandlerList getHandlers() { -@@ -0,0 +0,0 @@ public class PrepareSmithingEvent extends InventoryEvent { - public static HandlerList getHandlerList() { - return handlers; - } -+ */ // Paper +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - move HandlerList to PrepareInventoryResultEvent } diff --git a/patches/server/Add-PrepareResultEvent.patch b/patches/server/Add-PrepareResultEvent.patch index e8d8a1dd91..0007473564 100644 --- a/patches/server/Add-PrepareResultEvent.patch +++ b/patches/server/Add-PrepareResultEvent.patch @@ -107,13 +107,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - disable this method, handled below + public static void callPrepareAnvilEvent(InventoryView view, ItemStack item) { // Paper - verify nothing uses return - handled below in PrepareResult + PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item)); // Paper - remove clone -+ //event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // disable event ++ //event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // Paper - disable event event.getInventory().setItem(2, event.getResult()); - return event; + //return event; // Paper } + // Paper end +- public static PrepareGrindstoneEvent callPrepareGrindstoneEvent(InventoryView view, ItemStack item) { +- PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item).clone()); +- event.getView().getPlayer().getServer().getPluginManager().callEvent(event); ++ // Paper start - disable this method, handled below ++ public static void callPrepareGrindstoneEvent(InventoryView view, ItemStack item) { ++ PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item)); // Paper - remove clone ++ // event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // Paper - disable event + event.getInventory().setItem(2, event.getResult()); +- return event; ++ // return event; // Paper + } ++ // Paper end + - public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) { - PrepareSmithingEvent event = new PrepareSmithingEvent(view, CraftItemStack.asCraftMirror(item).clone()); - event.getView().getPlayer().getServer().getPluginManager().callEvent(event); @@ -136,7 +149,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (view.getTopInventory() instanceof org.bukkit.inventory.AnvilInventory) { + event = new PrepareAnvilEvent(view, result); + } else if (view.getTopInventory() instanceof org.bukkit.inventory.GrindstoneInventory) { -+ event = new com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent(view, result); ++ event = new PrepareGrindstoneEvent(view, result); + } else if (view.getTopInventory() instanceof org.bukkit.inventory.SmithingInventory) { + event = new PrepareSmithingEvent(view, result); + } else { diff --git a/patches/server/Build-system-changes.patch b/patches/server/Build-system-changes.patch index 4dcc60e33b..b9f05ddb56 100644 --- a/patches/server/Build-system-changes.patch +++ b/patches/server/Build-system-changes.patch @@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -3); + deadline.add(Calendar.DAY_OF_YEAR, -7); diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/patches/server/Fix-interact-event-not-being-called-in-adventure.patch b/patches/server/Fix-interact-event-not-being-called-in-adventure.patch index cf636b2140..1122d7f6c2 100644 --- a/patches/server/Fix-interact-event-not-being-called-in-adventure.patch +++ b/patches/server/Fix-interact-event-not-being-called-in-adventure.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time - org.bukkit.util.RayTraceResult result = this.player.level.getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> entity != this.player.getBukkitEntity()); + org.bukkit.util.RayTraceResult result = this.player.level.getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity)); - if (result == null) { + if (result == null || this.player.gameMode.getGameModeForPlayer() == GameType.ADVENTURE) { // Paper - call PlayerInteractEvent when left-clicking on a block in adventure mode diff --git a/patches/server/Fix-this-stupid-bullshit.patch b/patches/server/Fix-this-stupid-bullshit.patch index 97d468a1d9..b0622a8f53 100644 --- a/patches/server/Fix-this-stupid-bullshit.patch +++ b/patches/server/Fix-this-stupid-bullshit.patch @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -3); + deadline.add(Calendar.DAY_OF_YEAR, -7); if (buildDate.before(deadline.getTime())) { - System.err.println("*** Error, this build is outdated ***"); + // Paper start - This is some stupid bullshit diff --git a/patches/server/Prevent-grindstones-from-overstacking-items.patch b/patches/server/Prevent-grindstones-from-overstacking-items.patch index a9b014d0d1..6ac5afe66b 100644 --- a/patches/server/Prevent-grindstones-from-overstacking-items.patch +++ b/patches/server/Prevent-grindstones-from-overstacking-items.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!itemstack2.isDamageableItem()) { - if (!ItemStack.matches(itemstack, itemstack1)) { + if (!ItemStack.matches(itemstack, itemstack1) || (itemstack2.getMaxStackSize() == 1 && !io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowGrindstoneOverstacking)) { // Paper - add max stack size check & config value - this.resultSlots.setItem(0, ItemStack.EMPTY); + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(this.getBukkitView(), ItemStack.EMPTY); // CraftBukkit this.broadcastChanges(); return; } diff --git a/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index f8d0466902..4f4f1a2f1e 100644 --- a/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { - deadline.add(Calendar.DAY_OF_YEAR, -3); + deadline.add(Calendar.DAY_OF_YEAR, -7); if (buildDate.before(deadline.getTime())) { System.err.println("*** Error, this build is outdated ***"); - System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***"); diff --git a/work/Bukkit b/work/Bukkit index dea9ce0a79..f50ad1f8b3 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit dea9ce0a799f48e90e17e0f8c3db89bfb7cda3cd +Subproject commit f50ad1f8b307cda71968d3f53921ab29d1e5835a diff --git a/work/CraftBukkit b/work/CraftBukkit index 4fa7e1c31d..ab1586c2fb 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 4fa7e1c31d8f2b8dd3ec002563f11c4136f15491 +Subproject commit ab1586c2fb5fa7a381e6191e1137acc69aeebbf2