From c919e944ffedf06a6a5625043bc744b06e499442 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 13 Dec 2022 21:03:57 -0800 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit) (#8663) 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: f50ad1f8 PR-798: Add PrepareGrindstoneEvent and refactor related events to use PrepareInventoryResultEvent 0cac7963 SPIGOT-7204: Add TeleportCause#DISMOUNT b4dd47b0 SPIGOT-7202: Deprecate removed door effects CraftBukkit Changes: ab1586c2f PR-1123: Add PrepareGrindstoneEvent b402824ea SPIGOT-7204: Add TeleportCause#DISMOUNT 06a6a1012 PR-1121: Add unit test for spawn egg meta c18668be3 SPIGOT-7192: Call PlayerInteractEvent with Action.LEFT_CLICK_AIR if the entity interacted is hidden to the player 47124f639 Increase outdated build delay 645993470 SPIGOT-7201: Spawner ItemMeta not working as expected --- ...reResultEvent-PrepareGrindstoneEvent.patch | 215 ++++++++---------- patches/api/0270-Add-missing-effects.patch | 6 +- patches/api/0387-More-Teleport-API.patch | 4 +- .../server/0003-Build-system-changes.patch | 4 +- patches/server/0009-Adventure.patch | 10 +- ...ient-crashes-server-lists-and-Mojang.patch | 8 +- patches/server/0109-Add-EntityZapEvent.patch | 4 +- ...3-Add-source-to-PlayerExpChangeEvent.patch | 4 +- .../0114-Add-ProjectileCollideEvent.patch | 4 +- .../0151-Fix-this-stupid-bullshit.patch | 4 +- .../0176-Add-ArmorStand-Item-Meta.patch | 4 +- .../0217-InventoryCloseEvent-Reason-API.patch | 10 +- ...8-Vanished-players-don-t-have-rights.patch | 4 +- ...on-t-call-getItemMeta-on-hasItemMeta.patch | 4 +- .../server/0255-Improve-death-events.patch | 12 +- .../0312-Mob-Spawner-API-Enhancements.patch | 4 +- ...358-add-hand-to-BlockMultiPlaceEvent.patch | 4 +- ...m-duplication-issues-and-teleport-is.patch | 6 +- ...-maximum-exp-value-when-merging-orbs.patch | 4 +- .../server/0402-ExperienceOrbMergeEvent.patch | 4 +- .../server/0446-Add-PrepareResultEvent.patch | 23 +- ...-OBSTRUCTED-reason-to-BedEnterResult.patch | 4 +- ...-event-not-being-called-in-adventure.patch | 4 +- ...Implemented-BlockFailedDispenseEvent.patch | 4 +- ...PI-to-expose-exact-interaction-point.patch | 6 +- ...0558-Implement-BlockPreDispenseEvent.patch | 4 +- ...Leash-variable-to-EntityUnleashEvent.patch | 4 +- ...w-adding-items-to-BlockDropItemEvent.patch | 4 +- ...-grindstones-from-overstacking-items.patch | 4 +- .../server/0692-Add-critical-damage-API.patch | 10 +- ...-interactions-with-items-on-cooldown.patch | 6 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- 33 files changed, 197 insertions(+), 199 deletions(-) diff --git a/patches/api/0213-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch b/patches/api/0213-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch index 5dc61d601d..2ff5ec318b 100644 --- a/patches/api/0213-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch +++ b/patches/api/0213-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch @@ -11,14 +11,12 @@ Grindstone is a backwards compat from a previous PrepareGrindstoneEvent diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..449e8c06f8434b59d49a76481fa60c5c49e80579 +index 0000000000000000000000000000000000000000..a89d189e1175e980e5af8476f539f0a025e8903b --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java -@@ -0,0 +1,28 @@ +@@ -0,0 +1,26 @@ +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..449e8c06f8434b59d49a76481fa60c5c + +/** + * 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 { @@ -45,15 +43,13 @@ index 0000000000000000000000000000000000000000..449e8c06f8434b59d49a76481fa60c5c +} diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..045ce9ec3c9134aced5f5235b760ac85599d16c6 +index 0000000000000000000000000000000000000000..25e5f0354b3b65c656d6c173ec108825f1e8b1be --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java -@@ -0,0 +1,48 @@ +@@ -0,0 +1,37 @@ +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..045ce9ec3c9134aced5f5235b760ac85 +/** + * 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..045ce9ec3c9134aced5f5235b760ac85 + */ + @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 77109a07f07aa6985106dc1a9ad5218f6c7f360f..f1f6f4ab4f81a3f21e757fef4a30b00e94371f8d 100644 +index 6782024735a885ba0b1b4dba4a576740c1410366..8695715c10d81b06c088ff0c8d401875d26879b5 100644 --- a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java +++ b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java -@@ -1,5 +1,6 @@ - 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; -@@ -10,14 +11,16 @@ import org.jetbrains.annotations.Nullable; +@@ -10,9 +10,9 @@ 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); +@@ -24,14 +24,5 @@ public class PrepareAnvilEvent extends PrepareInventoryResultEvent { + return (AnvilInventory) super.getInventory(); } - @NotNull -@@ -33,13 +36,14 @@ 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() { -@@ -50,4 +54,5 @@ 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 fb172479ce28edbf969b9492236e30fb04395bf9..a7e03600099b8d6a117b8f5455fee24eed03e3a3 100644 +--- a/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java +@@ -10,9 +10,9 @@ 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); +@@ -24,14 +24,5 @@ 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 b543bc17fb9354d1939c67c1fb6c92d88fdbe4ec..656ffd4cf7851d6862cc9b675502efa03f4eb94c 100644 +--- a/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java +@@ -8,7 +8,9 @@ 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 99af1540324c4d68c5890ac40b591c5cbdd2e870..0bc0ca4f96c800e9c46c61710f44446691d8b93f 100644 +index 901774e03f8789dddff4e7695ac599ff69cc97a5..8d7924fa81e9b53514fa534f0572fd7effef73c4 100644 --- a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java +++ b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java -@@ -1,5 +1,6 @@ - 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; -@@ -10,14 +11,16 @@ import org.jetbrains.annotations.Nullable; +@@ -10,9 +10,9 @@ 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); +@@ -24,14 +24,5 @@ public class PrepareSmithingEvent extends PrepareInventoryResultEvent { + return (SmithingInventory) super.getInventory(); } - @NotNull -@@ -33,13 +36,14 @@ 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() { -@@ -50,4 +54,5 @@ 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/api/0270-Add-missing-effects.patch b/patches/api/0270-Add-missing-effects.patch index f00165350a..17eba7efe0 100644 --- a/patches/api/0270-Add-missing-effects.patch +++ b/patches/api/0270-Add-missing-effects.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add missing effects diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java -index bf752c5a71bcafe740be281cb6ef5a756c839534..3f2fb26455f6a71e43281098a2291ccf25635348 100644 +index 879d637691683ca862045402f74b751a892bf3ff..e6573b8bd45e0d3ae4f46d64996fa67f13d29f2b 100644 --- a/src/main/java/org/bukkit/Effect.java +++ b/src/main/java/org/bukkit/Effect.java -@@ -307,7 +307,100 @@ public enum Effect { +@@ -337,7 +337,100 @@ public enum Effect { * block. */ OXIDISED_COPPER_SCRAPE(3005, Type.VISUAL), @@ -109,7 +109,7 @@ index bf752c5a71bcafe740be281cb6ef5a756c839534..3f2fb26455f6a71e43281098a2291ccf private final int id; private final Type type; -@@ -367,10 +460,22 @@ public enum Effect { +@@ -397,10 +490,22 @@ public enum Effect { static { for (Effect effect : values()) { diff --git a/patches/api/0387-More-Teleport-API.patch b/patches/api/0387-More-Teleport-API.patch index e447969418..e4eb33f55e 100644 --- a/patches/api/0387-More-Teleport-API.patch +++ b/patches/api/0387-More-Teleport-API.patch @@ -235,7 +235,7 @@ index 82d9cfadb00da9b7c2034938780354a573801728..8bac7b0b762a75a6535b50351850192a @Override Spigot spigot(); diff --git a/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java b/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java -index 553d7740489fe729166c8ca8ef8c7834db3663ad..5b9c750cc3fdbb21c0e16f9df7740cb1f916170a 100644 +index 113e620ce38bb8ff97cf24e309af59b717774b36..149725da2468cf2e8cf3877f78b4a9b749ec1e51 100644 --- a/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java @@ -13,8 +13,14 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { @@ -271,7 +271,7 @@ index 553d7740489fe729166c8ca8ef8c7834db3663ad..5b9c750cc3fdbb21c0e16f9df7740cb1 /** * Gets the cause of this teleportation event * -@@ -80,6 +97,30 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { +@@ -84,6 +101,30 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { UNKNOWN; } diff --git a/patches/server/0003-Build-system-changes.patch b/patches/server/0003-Build-system-changes.patch index ff5c8f296a..6f1e65c3ae 100644 --- a/patches/server/0003-Build-system-changes.patch +++ b/patches/server/0003-Build-system-changes.patch @@ -67,7 +67,7 @@ index 40d1dcd4a0870cf002ee6d0309ce667f49a89d35..a2d2c817cdc1798cd30b3a852b3a495b exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class") } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index daec3479f451b322934000dc2942cdd6aff122ac..68aafbe2ff05ad2c48b8f3ed23d779680bca574a 100644 +index 3790fd4f33a1fcd7d1430032af146cc724fcde61..16c38195c3e4f5550122df0d65fcce8ca3a83822 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -192,7 +192,7 @@ public class Main { @@ -78,7 +78,7 @@ index daec3479f451b322934000dc2942cdd6aff122ac..68aafbe2ff05ad2c48b8f3ed23d77968 + 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 93046379d0cefd5d3236fc59e698809acdc18f80..774556a62eb240da42e84db4502e2ed43495be17 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/patches/server/0009-Adventure.patch b/patches/server/0009-Adventure.patch index 8f03fbb203..3a4adab444 100644 --- a/patches/server/0009-Adventure.patch +++ b/patches/server/0009-Adventure.patch @@ -2070,7 +2070,7 @@ index 48972d64710fb0d3821e7c1a0722a1d203c47e07..6a8c67dc668c775809227b455b2dd522 // CraftBukkit end this.chatVisibility = packet.chatVisibility(); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3e37ce53e31b0c4e362ff7eefb3662d7d1aabea4..91a0b7923b5a39a7de5d7899002ec4cd4a987a47 100644 +index 478d40c7cc0374cddb76486b6bd148a846a16813..f4502ebedb31b101faa6c99c4fa51fb5b4fdf3f0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -185,6 +185,8 @@ import net.minecraft.world.phys.shapes.VoxelShape; @@ -2702,7 +2702,7 @@ index f4455d8a45fbd687a21a46a4c2850f9a3e6432c5..e91305263fcf6929fe62e5e8da467217 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index a857f9e20d2fe0f495df884e81489e89a64bea54..e2cf043fb35ae8474bf1f6ba2cc2505566973cfe 100644 +index 1d4f6e7fcfaaee40b06f74d250d04f7a36b6458b..f7b2211d04bb6b4a11ad7499c6e3a0e945e6d9da 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -19,6 +19,12 @@ public class Main { @@ -3662,10 +3662,10 @@ index d2be98416529aea3bdbedd0ea7131bd8de2a0162..6c316c969e87d9da047cd80c15d5579f private final Player.Spigot spigot = new Player.Spigot() { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 2eb41a4a7cca5a3635451a9910bbdc826c987a02..e303445b64ce59158567a2ab7388e7fe3627e055 100644 +index 92ce3bae7116157b66ed657fe3dc9d4f709bab11..3b520b1301eb0225cdcbb271c8032726c59d3990 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -820,9 +820,9 @@ public class CraftEventFactory { +@@ -821,9 +821,9 @@ public class CraftEventFactory { return event; } @@ -3677,7 +3677,7 @@ index 2eb41a4a7cca5a3635451a9910bbdc826c987a02..e303445b64ce59158567a2ab7388e7fe event.setKeepInventory(keepInventory); event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel org.bukkit.World world = entity.getWorld(); -@@ -847,7 +847,7 @@ public class CraftEventFactory { +@@ -848,7 +848,7 @@ public class CraftEventFactory { * Server methods */ public static ServerListPingEvent callServerListPingEvent(Server craftServer, InetAddress address, String motd, int numPlayers, int maxPlayers) { diff --git a/patches/server/0025-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/0025-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index 272ca6f08d..330cb67fc7 100644 --- a/patches/server/0025-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/0025-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 11fd961b2b522920ceb5cde7dbf5cc197044836a..7e313778c44c2b06543c95b5687c2dd841b5216a 100644 +index e9f4ffec4b659f3300daa0138f6e955a8d97786d..e2e66fd4bd34e0ceaab350214a50ddbb1dc76184 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1433,7 +1433,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop collection, boolean force) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 99b5db683591b42cf6c88dcd6b9a4aa0cf769ce4..2dfade8cc1e5e7e774d876d1e60c692aca0ef739 100644 +index b653121dc16ce4ab3f32456e0c8690e022aa263c..2d55260f4c753bfdd9f7fca69f1a9a1df0d28d1c 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -806,9 +806,16 @@ public class CraftEventFactory { +@@ -807,9 +807,16 @@ public class CraftEventFactory { public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, List drops) { CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward()); @@ -354,7 +354,7 @@ index 99b5db683591b42cf6c88dcd6b9a4aa0cf769ce4..2dfade8cc1e5e7e774d876d1e60c692a victim.expToDrop = event.getDroppedExp(); for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { -@@ -825,8 +832,15 @@ public class CraftEventFactory { +@@ -826,8 +833,15 @@ public class CraftEventFactory { PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage, stringDeathMessage); // Paper - Adventure event.setKeepInventory(keepInventory); event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel @@ -370,7 +370,7 @@ index 99b5db683591b42cf6c88dcd6b9a4aa0cf769ce4..2dfade8cc1e5e7e774d876d1e60c692a victim.keepLevel = event.getKeepLevel(); victim.newLevel = event.getNewLevel(); -@@ -843,6 +857,31 @@ public class CraftEventFactory { +@@ -844,6 +858,31 @@ public class CraftEventFactory { return event; } diff --git a/patches/server/0312-Mob-Spawner-API-Enhancements.patch b/patches/server/0312-Mob-Spawner-API-Enhancements.patch index 3edc0458a5..4a8446e79a 100644 --- a/patches/server/0312-Mob-Spawner-API-Enhancements.patch +++ b/patches/server/0312-Mob-Spawner-API-Enhancements.patch @@ -69,10 +69,10 @@ index 6ba97a0b4f2cb15d5435657c8e8f5c71c6fee3db..c5a117308f051c20b81818ad91e0ca40 nbt.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities); nbt.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java -index 590d77470e979b331917aaa8cbc30a6513e385db..6887b479488e8d25c6170c29ce7955df927cba68 100644 +index e8f888b9e37454d9863fbaf0f0c3dc982d582f1e..95b01ddddb1ba90da495927099147e775fb4f7aa 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java -@@ -116,4 +116,28 @@ public class CraftCreatureSpawner extends CraftBlockEntityState drops) { @@ -150,7 +150,7 @@ index b35dd78b08b15842e87182de9afef6c49c249366..120e21edad328f382b5edc030f546e3b CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward()); populateFields(victim, event); // Paper - make cancellable -@@ -822,11 +827,13 @@ public class CraftEventFactory { +@@ -823,11 +828,13 @@ public class CraftEventFactory { playDeathSound(victim, event); // Paper end victim.expToDrop = event.getDroppedExp(); diff --git a/patches/server/0401-Option-for-maximum-exp-value-when-merging-orbs.patch b/patches/server/0401-Option-for-maximum-exp-value-when-merging-orbs.patch index b5449e0ac6..6e847de4a8 100644 --- a/patches/server/0401-Option-for-maximum-exp-value-when-merging-orbs.patch +++ b/patches/server/0401-Option-for-maximum-exp-value-when-merging-orbs.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Option for maximum exp value when merging orbs diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 120e21edad328f382b5edc030f546e3b9a80916b..2fd5e1b4f20c28ebed0b480cc866ed05cb739462 100644 +index 7069b447c12c170683dee7052327a55c29af83c4..a8d9ad5eba330c23d2cc745242977f4fb1b4c674 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -630,16 +630,30 @@ public class CraftEventFactory { +@@ -631,16 +631,30 @@ public class CraftEventFactory { net.minecraft.world.entity.ExperienceOrb xp = (net.minecraft.world.entity.ExperienceOrb) entity; double radius = world.spigotConfig.expMerge; if (radius > 0) { diff --git a/patches/server/0402-ExperienceOrbMergeEvent.patch b/patches/server/0402-ExperienceOrbMergeEvent.patch index baf8b9eba9..e71bdda1e5 100644 --- a/patches/server/0402-ExperienceOrbMergeEvent.patch +++ b/patches/server/0402-ExperienceOrbMergeEvent.patch @@ -9,10 +9,10 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor metadata such as spawn reason, or conditionally move data from source to target. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 2fd5e1b4f20c28ebed0b480cc866ed05cb739462..571eb0eea3bf7b0cf567cdf571699e729402fda0 100644 +index a8d9ad5eba330c23d2cc745242977f4fb1b4c674..4610d7d329c9c8bf3cbe8c203fe8c89413717df2 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -640,7 +640,7 @@ public class CraftEventFactory { +@@ -641,7 +641,7 @@ public class CraftEventFactory { if (e instanceof net.minecraft.world.entity.ExperienceOrb) { net.minecraft.world.entity.ExperienceOrb loopItem = (net.minecraft.world.entity.ExperienceOrb) e; // Paper start diff --git a/patches/server/0446-Add-PrepareResultEvent.patch b/patches/server/0446-Add-PrepareResultEvent.patch index 24fbc4d4ae..38315bb7d8 100644 --- a/patches/server/0446-Add-PrepareResultEvent.patch +++ b/patches/server/0446-Add-PrepareResultEvent.patch @@ -32,7 +32,7 @@ index 74447bd2ff36c5360db52d2a56fe3fbe56aee7d2..7733b5271307849e3e56c6089649c4ca private void setupResultSlot(ItemStack map, ItemStack item, ItemStack oldResult) { diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java -index 9010656b7f013d50872017a298368ec8a3016e9c..00e2148419517c94def76f0a75562cc0093ea3ed 100644 +index e3c3d202a9852adf32d5e94c9011c3799668419b..d610bd1468d506416fe61bf93d6be3bd0dc042a9 100644 --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java @@ -159,6 +159,7 @@ public class GrindstoneMenu extends AbstractContainerMenu { @@ -94,10 +94,10 @@ index 78c1bd1c709ef29ccfa75fa87d8af1217cc57b59..4ee54e3a61588e5574e3f7ba06a73bbd private void setupRecipeList(Container input, ItemStack stack) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 571eb0eea3bf7b0cf567cdf571699e729402fda0..88fb677231e13d714e20ae55c08443212b0512a9 100644 +index 4610d7d329c9c8bf3cbe8c203fe8c89413717df2..1c3419d6b7cdc13485e2667c9bc55bd28d607094 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1584,19 +1584,44 @@ public class CraftEventFactory { +@@ -1585,26 +1585,53 @@ public class CraftEventFactory { return event; } @@ -107,13 +107,26 @@ index 571eb0eea3bf7b0cf567cdf571699e729402fda0..88fb677231e13d714e20ae55c0844321 + // 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 571eb0eea3bf7b0cf567cdf571699e729402fda0..88fb677231e13d714e20ae55c0844321 + 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/0522-Add-OBSTRUCTED-reason-to-BedEnterResult.patch b/patches/server/0522-Add-OBSTRUCTED-reason-to-BedEnterResult.patch index 98020c31a5..da86add647 100644 --- a/patches/server/0522-Add-OBSTRUCTED-reason-to-BedEnterResult.patch +++ b/patches/server/0522-Add-OBSTRUCTED-reason-to-BedEnterResult.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add OBSTRUCTED reason to BedEnterResult diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 88fb677231e13d714e20ae55c08443212b0512a9..672b1000daf839d69a06cb3daf9f6dbb86b2cbdc 100644 +index 1c3419d6b7cdc13485e2667c9bc55bd28d607094..9dfbf59fd781e649579dd7082e8ea0ffaa7885d3 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -264,6 +264,10 @@ public class CraftEventFactory { +@@ -265,6 +265,10 @@ public class CraftEventFactory { return BedEnterResult.TOO_FAR_AWAY; case NOT_SAFE: return BedEnterResult.NOT_SAFE; diff --git a/patches/server/0534-Fix-interact-event-not-being-called-in-adventure.patch b/patches/server/0534-Fix-interact-event-not-being-called-in-adventure.patch index 74e8ac8471..ba849b98ba 100644 --- a/patches/server/0534-Fix-interact-event-not-being-called-in-adventure.patch +++ b/patches/server/0534-Fix-interact-event-not-being-called-in-adventure.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix interact event not being called in adventure Call PlayerInteractEvent when left-clicking on a block in adventure mode diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index dbe3cab9dfd86081aab876488fda576810ce2105..a21117908a8e1ccbb23fa79cfcc7a6d956ba6a51 100644 +index fd5d2c17471229df9f9f0fb21a9407657231c9af..ee3966cd5df09fda88a269105de8fe11736b55b3 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1847,7 +1847,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -20,7 +20,7 @@ index dbe3cab9dfd86081aab876488fda576810ce2105..a21117908a8e1ccbb23fa79cfcc7a6d9 } @@ -2473,7 +2473,7 @@ 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/0542-Implemented-BlockFailedDispenseEvent.patch b/patches/server/0542-Implemented-BlockFailedDispenseEvent.patch index cc7f377595..8710a5c690 100644 --- a/patches/server/0542-Implemented-BlockFailedDispenseEvent.patch +++ b/patches/server/0542-Implemented-BlockFailedDispenseEvent.patch @@ -32,10 +32,10 @@ index 1415ad60163f6584619cc7caa61f1848d6ebaa93..801c4c120e98584bcf218a4ef9bd66d7 } else { ItemStack itemstack = tileentitydispenser.getItem(i); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 672b1000daf839d69a06cb3daf9f6dbb86b2cbdc..13f97a07ccc1686b6660f60db4af5428f3247e3e 100644 +index 9dfbf59fd781e649579dd7082e8ea0ffaa7885d3..b98ba88d5bf423cee6d88133f021e748171a37c6 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1858,4 +1858,12 @@ public class CraftEventFactory { +@@ -1868,4 +1868,12 @@ public class CraftEventFactory { EntitiesUnloadEvent event = new EntitiesUnloadEvent(new CraftChunk((ServerLevel) world, coords.x, coords.z), bukkitEntities); Bukkit.getPluginManager().callEvent(event); } diff --git a/patches/server/0547-Implement-API-to-expose-exact-interaction-point.patch b/patches/server/0547-Implement-API-to-expose-exact-interaction-point.patch index d285450eae..30140949bb 100644 --- a/patches/server/0547-Implement-API-to-expose-exact-interaction-point.patch +++ b/patches/server/0547-Implement-API-to-expose-exact-interaction-point.patch @@ -18,7 +18,7 @@ index b0096fe5399397d4c5e170daa892aef017108c2f..645a226c2e3f6dcf1c25187d006d4250 this.interactResult = event.useItemInHand() == Event.Result.DENY; this.interactPosition = blockposition.immutable(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 13f97a07ccc1686b6660f60db4af5428f3247e3e..3a2dfd81f25c50ea7388bc68d37d59999187c645 100644 +index b98ba88d5bf423cee6d88133f021e748171a37c6..3b7c3e15db25c04d818eef4ab6562649597d39f4 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -56,7 +56,9 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; @@ -31,7 +31,7 @@ index 13f97a07ccc1686b6660f60db4af5428f3247e3e..3a2dfd81f25c50ea7388bc68d37d5999 import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.Server; -@@ -473,7 +475,13 @@ public class CraftEventFactory { +@@ -474,7 +476,13 @@ public class CraftEventFactory { return CraftEventFactory.callPlayerInteractEvent(who, action, position, direction, itemstack, false, hand); } @@ -45,7 +45,7 @@ index 13f97a07ccc1686b6660f60db4af5428f3247e3e..3a2dfd81f25c50ea7388bc68d37d5999 Player player = (who == null) ? null : (Player) who.getBukkitEntity(); CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack); -@@ -499,7 +507,10 @@ public class CraftEventFactory { +@@ -500,7 +508,10 @@ public class CraftEventFactory { itemInHand = null; } diff --git a/patches/server/0558-Implement-BlockPreDispenseEvent.patch b/patches/server/0558-Implement-BlockPreDispenseEvent.patch index 54b07d1507..48fbb801a3 100644 --- a/patches/server/0558-Implement-BlockPreDispenseEvent.patch +++ b/patches/server/0558-Implement-BlockPreDispenseEvent.patch @@ -17,10 +17,10 @@ index 85c5319837295bd2f85baebfe8d6660b267f1d5f..8f55d0753fa26924235c943595f0d1a0 tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack)); } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 3a2dfd81f25c50ea7388bc68d37d59999187c645..8c4211306b16031c58e407381965d0fe5223e1a8 100644 +index 3b7c3e15db25c04d818eef4ab6562649597d39f4..638f05ab3c3986b26339867f71c179b30a4e5f6b 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1876,5 +1876,11 @@ public class CraftEventFactory { +@@ -1886,5 +1886,11 @@ public class CraftEventFactory { io.papermc.paper.event.block.BlockFailedDispenseEvent event = new io.papermc.paper.event.block.BlockFailedDispenseEvent(block); return event.callEvent(); } diff --git a/patches/server/0562-Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/server/0562-Add-dropLeash-variable-to-EntityUnleashEvent.patch index 6805915037..7679159950 100644 --- a/patches/server/0562-Add-dropLeash-variable-to-EntityUnleashEvent.patch +++ b/patches/server/0562-Add-dropLeash-variable-to-EntityUnleashEvent.patch @@ -122,10 +122,10 @@ index 88c7e494051bc3d2c134167318f3eb84abaa2125..6672ca0e82048c23405845a8f5df49ac } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 8c4211306b16031c58e407381965d0fe5223e1a8..e29fef212f7db7e1d4ec3e3f43758c9866389765 100644 +index 638f05ab3c3986b26339867f71c179b30a4e5f6b..a0cc7dc09bfb74e0101e53c5c53dcf9438541ee0 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1517,8 +1517,10 @@ public class CraftEventFactory { +@@ -1518,8 +1518,10 @@ public class CraftEventFactory { return itemInHand; } diff --git a/patches/server/0568-Allow-adding-items-to-BlockDropItemEvent.patch b/patches/server/0568-Allow-adding-items-to-BlockDropItemEvent.patch index 6035412e8c..741b663ed1 100644 --- a/patches/server/0568-Allow-adding-items-to-BlockDropItemEvent.patch +++ b/patches/server/0568-Allow-adding-items-to-BlockDropItemEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow adding items to BlockDropItemEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index e29fef212f7db7e1d4ec3e3f43758c9866389765..8f248352fa17d96a5d64d0ad52e4de61beee0a62 100644 +index a0cc7dc09bfb74e0101e53c5c53dcf9438541ee0..5927968003b6ff55bd524244338c236892d4ca88 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -399,13 +399,30 @@ public class CraftEventFactory { +@@ -400,13 +400,30 @@ public class CraftEventFactory { } public static void handleBlockDropItemEvent(Block block, BlockState state, ServerPlayer player, List items) { diff --git a/patches/server/0582-Prevent-grindstones-from-overstacking-items.patch b/patches/server/0582-Prevent-grindstones-from-overstacking-items.patch index 4e2a359905..34d10bd3c9 100644 --- a/patches/server/0582-Prevent-grindstones-from-overstacking-items.patch +++ b/patches/server/0582-Prevent-grindstones-from-overstacking-items.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent grindstones from overstacking items diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java -index 00e2148419517c94def76f0a75562cc0093ea3ed..08e9cc68fa88e4ca42fa26c1425f101e72c094cb 100644 +index d610bd1468d506416fe61bf93d6be3bd0dc042a9..233e8626280a8b93dcb8621a1405e8c308c6836b 100644 --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java @@ -198,13 +198,13 @@ public class GrindstoneMenu extends AbstractContainerMenu { @@ -14,7 +14,7 @@ index 00e2148419517c94def76f0a75562cc0093ea3ed..08e9cc68fa88e4ca42fa26c1425f101e 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/0692-Add-critical-damage-API.patch b/patches/server/0692-Add-critical-damage-API.patch index 347b9b645a..ba3ffdd811 100644 --- a/patches/server/0692-Add-critical-damage-API.patch +++ b/patches/server/0692-Add-critical-damage-API.patch @@ -72,10 +72,10 @@ index 61d4a58ab25ce3bdf7ced426d2f92bc75ef02f7d..dcd3c5b4d3982f02214f8e0306eab37e int k = entity.getRemainingFireTicks(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 8f248352fa17d96a5d64d0ad52e4de61beee0a62..debaeb0ccf78c6a65efa13c8158d1ef4d90bdedd 100644 +index 5927968003b6ff55bd524244338c236892d4ca88..e3b44666564cf40f015daff6ad1109bd5983fcfa 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -969,7 +969,7 @@ public class CraftEventFactory { +@@ -970,7 +970,7 @@ public class CraftEventFactory { } else { damageCause = DamageCause.ENTITY_EXPLOSION; } @@ -84,7 +84,7 @@ index 8f248352fa17d96a5d64d0ad52e4de61beee0a62..debaeb0ccf78c6a65efa13c8158d1ef4 } event.setCancelled(cancelled); -@@ -998,7 +998,7 @@ public class CraftEventFactory { +@@ -999,7 +999,7 @@ public class CraftEventFactory { cause = DamageCause.SONIC_BOOM; } @@ -93,7 +93,7 @@ index 8f248352fa17d96a5d64d0ad52e4de61beee0a62..debaeb0ccf78c6a65efa13c8158d1ef4 } else if (source == DamageSource.OUT_OF_WORLD) { EntityDamageEvent event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.VOID, modifiers, modifierFunctions); event.setCancelled(cancelled); -@@ -1068,7 +1068,7 @@ public class CraftEventFactory { +@@ -1069,7 +1069,7 @@ public class CraftEventFactory { } else { throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.msgId)); } @@ -102,7 +102,7 @@ index 8f248352fa17d96a5d64d0ad52e4de61beee0a62..debaeb0ccf78c6a65efa13c8158d1ef4 event.setCancelled(cancelled); CraftEventFactory.callEvent(event); if (!event.isCancelled()) { -@@ -1113,20 +1113,28 @@ public class CraftEventFactory { +@@ -1114,20 +1114,28 @@ public class CraftEventFactory { } if (cause != null) { diff --git a/patches/server/0909-Correctly-handle-interactions-with-items-on-cooldown.patch b/patches/server/0909-Correctly-handle-interactions-with-items-on-cooldown.patch index 041aea6fc1..0f681af26a 100644 --- a/patches/server/0909-Correctly-handle-interactions-with-items-on-cooldown.patch +++ b/patches/server/0909-Correctly-handle-interactions-with-items-on-cooldown.patch @@ -30,10 +30,10 @@ index 13031576c20bda3bb12c926f6cd938fa5fb105f2..58b093bb1de78ee3b3b2ea364aa50474 this.interactResult = event.useItemInHand() == Event.Result.DENY; this.interactPosition = blockposition.immutable(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index debaeb0ccf78c6a65efa13c8158d1ef4d90bdedd..ae59a1259db4c4cef6f0cd128850229a63491845 100644 +index e3b44666564cf40f015daff6ad1109bd5983fcfa..dd063e8b0df7505a96cd25dc5c797c0c04dfdfd0 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -498,6 +498,12 @@ public class CraftEventFactory { +@@ -499,6 +499,12 @@ public class CraftEventFactory { } public static PlayerInteractEvent callPlayerInteractEvent(net.minecraft.world.entity.player.Player who, Action action, BlockPos position, Direction direction, ItemStack itemstack, boolean cancelledBlock, InteractionHand hand, Vec3 hitVec) { @@ -46,7 +46,7 @@ index debaeb0ccf78c6a65efa13c8158d1ef4d90bdedd..ae59a1259db4c4cef6f0cd128850229a // Paper end Player player = (who == null) ? null : (Player) who.getBukkitEntity(); CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack); -@@ -531,6 +537,11 @@ public class CraftEventFactory { +@@ -532,6 +538,11 @@ public class CraftEventFactory { if (cancelledBlock) { event.setUseInteractedBlock(Event.Result.DENY); } 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