From ad30e27e98d4b7baf2e7b6ae69460135ab47b3b4 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 26 Jan 2024 20:17:06 +0100 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit/Spigot) 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: 1d522878 PR-966: Introduce getRespawnLocation as a replacement for getBedSpawnLocation cc01b745 PR-965: Add DragonBattle#setPreviouslyKilled 28e3702f SPIGOT-6921, PR-957: Add methods to remove all enchantments on an ItemStack 8872404e PR-961: Add BlockData#copyTo 4054cc7b PR-956: Add method to get an offline player's location CraftBukkit Changes: 292ec79e0 SPIGOT-7568: Call EntityChangeBlockEvent for DecoratedPot b44bf5aa8 SPIGOT-7575: SuspiciousStewMeta creates invalid PotionEffect data 161784713 PR-1340: Centralize the conversion from and to Minecraft / Bukkit registry items even more and add a test case for them b93c5a30d PR-1338: Introduce getRespawnLocation as a replacement for getBedSpawnLocation fb973486c SPIGOT-7570: PrepareItemCraftEvent#isRepair() always returns false c9c24535e PR-1337: Add DragonBattle#setPreviouslyKilled c8b4da803 SPIGOT-6921, PR-1330: Add methods to remove all enchantments on an ItemStack 95bc1c4f5 PR-1333: Add BlockData#copyTo 36e2f9ce1 PR-1329: Add method to get an offline player's location Spigot Changes: c198da22 SPIGOT-7563: Update to latest release of bungeecord-chat --- ...-replace-OfflinePlayer-getLastPlayed.patch | 4 +- patches/api/Adventure.patch | 4 +- ...low-plugins-to-use-SLF4J-for-logging.patch | 2 +- patches/api/Convert-project-to-Gradle.patch | 4 +- patches/server/Add-PlayerSetSpawnEvent.patch | 2 +- .../server/Add-StructuresLocateEvent.patch | 18 ++++- .../Add-methods-to-get-translation-keys.patch | 2 +- patches/server/Adventure.patch | 2 +- ...cactus-bamboo-and-reed-growth-height.patch | 4 +- patches/server/Fix-SuspiciousStewMeta.patch | 21 ----- .../Handle-Item-Meta-Inconsistencies.patch | 1 + patches/server/Improve-Registry.patch | 14 ++-- patches/server/More-Enchantment-API.patch | 4 +- .../server/More-PotionEffectType-API.patch | 12 +-- patches/server/Remap-fixes.patch | 76 +++++++++---------- patches/server/Test-changes.patch | 4 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 19 files changed, 87 insertions(+), 93 deletions(-) delete mode 100644 patches/server/Fix-SuspiciousStewMeta.patch diff --git a/patches/api/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/patches/api/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch index 9a6d32190e..d9ae817577 100644 --- a/patches/api/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch +++ b/patches/api/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch @@ -30,8 +30,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** @@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio - */ @Nullable + @Deprecated public Location getBedSpawnLocation(); + // Paper start + /** @@ -59,4 +59,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end /** - * Increments the given statistic for this player. + * Gets the Location where the player will spawn at, null if they diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index 20532ea295..2175563f9a 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ java { val annotationsVersion = "24.0.1" - val bungeeCordChatVersion = "1.20-R0.1" + val bungeeCordChatVersion = "1.20-R0.2" +val adventureVersion = "4.15.0" +val apiAndDocs: Configuration by configurations.creating { + attributes { @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 api("com.google.code.gson:gson:2.10.1") - api("net.md-5:bungeecord-chat:$bungeeCordChatVersion") + // Paper start - adventure -+ api("net.md-5:bungeecord-chat:$bungeeCordChatVersion-deprecated+build.14") { ++ api("net.md-5:bungeecord-chat:$bungeeCordChatVersion-deprecated+build.18") { + exclude("com.google.guava", "guava") + } + // Paper - adventure diff --git a/patches/api/Allow-plugins-to-use-SLF4J-for-logging.patch b/patches/api/Allow-plugins-to-use-SLF4J-for-logging.patch index 38153e39f4..f1e37170e5 100644 --- a/patches/api/Allow-plugins-to-use-SLF4J-for-logging.patch +++ b/patches/api/Allow-plugins-to-use-SLF4J-for-logging.patch @@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/build.gradle.kts @@ -0,0 +0,0 @@ java { val annotationsVersion = "24.0.1" - val bungeeCordChatVersion = "1.20-R0.1" + val bungeeCordChatVersion = "1.20-R0.2" val adventureVersion = "4.15.0" +val slf4jVersion = "2.0.9" +val log4jVersion = "2.17.1" diff --git a/patches/api/Convert-project-to-Gradle.patch b/patches/api/Convert-project-to-Gradle.patch index c0c02107ea..17984fda0b 100644 --- a/patches/api/Convert-project-to-Gradle.patch +++ b/patches/api/Convert-project-to-Gradle.patch @@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +} + +val annotationsVersion = "24.0.1" -+val bungeeCordChatVersion = "1.20-R0.1" ++val bungeeCordChatVersion = "1.20-R0.2" + +dependencies { + // api dependencies are listed transitively to API consumers @@ -185,7 +185,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - net.md-5 - bungeecord-chat -- 1.20-R0.1 +- 1.20-R0.2 - jar - compile - diff --git a/patches/server/Add-PlayerSetSpawnEvent.patch b/patches/server/Add-PlayerSetSpawnEvent.patch index f9763c8cd5..33f0e5ae00 100644 --- a/patches/server/Add-PlayerSetSpawnEvent.patch +++ b/patches/server/Add-PlayerSetSpawnEvent.patch @@ -192,7 +192,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override - public void setBedSpawnLocation(Location location, boolean override) { + public void setRespawnLocation(Location location, boolean override) { if (location == null) { - this.getHandle().setRespawnPosition(null, null, 0.0F, override, false, PlayerSpawnChangeEvent.Cause.PLUGIN); + this.getHandle().setRespawnPosition(null, null, 0.0F, override, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLUGIN); // Paper - Add PlayerSetSpawnEvent diff --git a/patches/server/Add-StructuresLocateEvent.patch b/patches/server/Add-StructuresLocateEvent.patch index 276f811916..0ba063ce8d 100644 --- a/patches/server/Add-StructuresLocateEvent.patch +++ b/patches/server/Add-StructuresLocateEvent.patch @@ -193,10 +193,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + System.setOut(out); + } +} -diff --git a/src/test/java/org/bukkit/PerRegistryTest.java b/src/test/java/org/bukkit/PerRegistryTest.java +diff --git a/src/test/java/org/bukkit/registry/PerRegistryTest.java b/src/test/java/org/bukkit/registry/PerRegistryTest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/test/java/org/bukkit/PerRegistryTest.java -+++ b/src/test/java/org/bukkit/PerRegistryTest.java +--- a/src/test/java/org/bukkit/registry/PerRegistryTest.java ++++ b/src/test/java/org/bukkit/registry/PerRegistryTest.java @@ -0,0 +0,0 @@ public class PerRegistryTest extends AbstractTestingBase { if (!(object instanceof CraftRegistry registry)) { continue; @@ -205,3 +205,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 data.add(Arguments.of(registry)); } catch (ReflectiveOperationException e) { +diff --git a/src/test/java/org/bukkit/registry/RegistryArgumentAddedTest.java b/src/test/java/org/bukkit/registry/RegistryArgumentAddedTest.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/test/java/org/bukkit/registry/RegistryArgumentAddedTest.java ++++ b/src/test/java/org/bukkit/registry/RegistryArgumentAddedTest.java +@@ -0,0 +0,0 @@ public class RegistryArgumentAddedTest extends AbstractTestingBase { + + Set> loadedRegistries = new HashSet<>(DummyServer.registers.keySet()); + Set> notFound = new HashSet<>(); ++ loadedRegistries.remove(io.papermc.paper.world.structure.ConfiguredStructure.class); // Paper - ignore + + RegistriesArgumentProvider + .getData() diff --git a/patches/server/Add-methods-to-get-translation-keys.patch b/patches/server/Add-methods-to-get-translation-keys.patch index 5ea93c4752..2887b15d86 100644 --- a/patches/server/Add-methods-to-get-translation-keys.patch +++ b/patches/server/Add-methods-to-get-translation-keys.patch @@ -28,7 +28,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment. index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java -@@ -0,0 +0,0 @@ public class CraftEnchantment extends Enchantment { +@@ -0,0 +0,0 @@ public class CraftEnchantment extends Enchantment implements Handleable -Date: Sat, 23 Sep 2023 16:36:54 +0200 -Subject: [PATCH] Fix SuspiciousStewMeta - - -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java -@@ -0,0 +0,0 @@ import org.bukkit.potion.PotionEffectType; - @DelegateDeserialization(CraftMetaItem.SerializableMeta.class) - public class CraftMetaSuspiciousStew extends CraftMetaItem implements SuspiciousStewMeta { - -- static final ItemMetaKey DURATION = new ItemMetaKey("EffectDuration", "duration"); -- static final ItemMetaKey EFFECTS = new ItemMetaKey("Effects", "effects"); -+ static final ItemMetaKey DURATION = new ItemMetaKey("duration", "duration"); // Paper -+ static final ItemMetaKey EFFECTS = new ItemMetaKey(net.minecraft.world.item.SuspiciousStewItem.EFFECTS_TAG, "effects"); // Paper - static final ItemMetaKey ID = new ItemMetaKey("id", "id"); - - private List customEffects; diff --git a/patches/server/Handle-Item-Meta-Inconsistencies.patch b/patches/server/Handle-Item-Meta-Inconsistencies.patch index fcd82dbbf5..29f9541031 100644 --- a/patches/server/Handle-Item-Meta-Inconsistencies.patch +++ b/patches/server/Handle-Item-Meta-Inconsistencies.patch @@ -159,6 +159,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return level; } +@@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack { @Override public Map getEnchantments() { diff --git a/patches/server/Improve-Registry.patch b/patches/server/Improve-Registry.patch index 78eda09a93..f248288e66 100644 --- a/patches/server/Improve-Registry.patch +++ b/patches/server/Improve-Registry.patch @@ -40,30 +40,30 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMateri index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java -@@ -0,0 +0,0 @@ public class CraftTrimMaterial implements TrimMaterial { +@@ -0,0 +0,0 @@ public class CraftTrimMaterial implements TrimMaterial, Handleable this + " doesn't have a key"); // Paper return this.key; } - + } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java -@@ -0,0 +0,0 @@ public class CraftTrimPattern implements TrimPattern { +@@ -0,0 +0,0 @@ public class CraftTrimPattern implements TrimPattern, Handleable this + " doesn't have a key"); // Paper return this.key; } - -diff --git a/src/test/java/org/bukkit/PerRegistryTest.java b/src/test/java/org/bukkit/PerRegistryTest.java + } +diff --git a/src/test/java/org/bukkit/registry/PerRegistryTest.java b/src/test/java/org/bukkit/registry/PerRegistryTest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/test/java/org/bukkit/PerRegistryTest.java -+++ b/src/test/java/org/bukkit/PerRegistryTest.java +--- a/src/test/java/org/bukkit/registry/PerRegistryTest.java ++++ b/src/test/java/org/bukkit/registry/PerRegistryTest.java @@ -0,0 +0,0 @@ public class PerRegistryTest extends AbstractTestingBase { @ParameterizedTest diff --git a/patches/server/More-Enchantment-API.patch b/patches/server/More-Enchantment-API.patch index b3da8e8ef4..d595e6aa79 100644 --- a/patches/server/More-Enchantment-API.patch +++ b/patches/server/More-Enchantment-API.patch @@ -12,7 +12,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment. index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java -@@ -0,0 +0,0 @@ public class CraftEnchantment extends Enchantment { +@@ -0,0 +0,0 @@ public class CraftEnchantment extends Enchantment implements Handleable getEffectAttributes() { @@ -54,7 +53,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }; + } + // Paper end - } ++ + @Override + public boolean equals(Object other) { + if (this == other) { diff --git a/src/test/java/io/papermc/paper/effects/EffectCategoryTest.java b/src/test/java/io/papermc/paper/effects/EffectCategoryTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 diff --git a/patches/server/Remap-fixes.patch b/patches/server/Remap-fixes.patch index 3233483441..8735963535 100644 --- a/patches/server/Remap-fixes.patch +++ b/patches/server/Remap-fixes.patch @@ -131,44 +131,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 String.format(""" Could not encoded particle param for particle %s. This can indicated, that the wrong particle param is created in CraftParticle. -diff --git a/src/test/java/org/bukkit/RegistryConstantsTest.java b/src/test/java/org/bukkit/RegistryConstantsTest.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/test/java/org/bukkit/RegistryConstantsTest.java -+++ b/src/test/java/org/bukkit/RegistryConstantsTest.java -@@ -0,0 +0,0 @@ public class RegistryConstantsTest extends AbstractTestingBase { - - @Test - public void testTrimMaterial() { -- this.testExcessConstants(TrimMaterial.class, Registry.TRIM_MATERIAL); -+ this.testExcessConstants(TrimMaterial.class, org.bukkit.Registry.TRIM_MATERIAL); // Paper - remap fix - this.testMissingConstants(TrimMaterial.class, Registries.TRIM_MATERIAL); - } - - @Test - public void testTrimPattern() { -- this.testExcessConstants(TrimPattern.class, Registry.TRIM_PATTERN); -+ this.testExcessConstants(TrimPattern.class, org.bukkit.Registry.TRIM_PATTERN); // Paper - remap fix - this.testMissingConstants(TrimPattern.class, Registries.TRIM_PATTERN); - } - -- private void testExcessConstants(Class clazz, Registry registry) { -+ private void testExcessConstants(Class clazz, org.bukkit.Registry registry) { // Paper - remap fix - List excessKeys = new ArrayList<>(); - - for (Field field : clazz.getFields()) { -diff --git a/src/test/java/org/bukkit/RegistryLoadOrderTest.java b/src/test/java/org/bukkit/RegistryLoadOrderTest.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/test/java/org/bukkit/RegistryLoadOrderTest.java -+++ b/src/test/java/org/bukkit/RegistryLoadOrderTest.java -@@ -0,0 +0,0 @@ public class RegistryLoadOrderTest extends AbstractTestingBase { - - private static boolean initInterface = false; - private static boolean initAbstract = false; -- private static Registry registry; -+ private static org.bukkit.Registry registry; // Paper - remap fix - - public static Stream data() { - return Stream.of( diff --git a/src/test/java/org/bukkit/entity/EntityTypesTest.java b/src/test/java/org/bukkit/entity/EntityTypesTest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/test/java/org/bukkit/entity/EntityTypesTest.java @@ -224,3 +186,41 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 org.bukkit.entity.Panda.Gene bukkit = CraftPanda.fromNms(gene); assertNotNull(bukkit, "Bukkit gene null for " + gene); +diff --git a/src/test/java/org/bukkit/registry/RegistryConstantsTest.java b/src/test/java/org/bukkit/registry/RegistryConstantsTest.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/test/java/org/bukkit/registry/RegistryConstantsTest.java ++++ b/src/test/java/org/bukkit/registry/RegistryConstantsTest.java +@@ -0,0 +0,0 @@ public class RegistryConstantsTest extends AbstractTestingBase { + + @Test + public void testTrimMaterial() { +- this.testExcessConstants(TrimMaterial.class, Registry.TRIM_MATERIAL); ++ this.testExcessConstants(TrimMaterial.class, org.bukkit.Registry.TRIM_MATERIAL); // Paper - remap fix + this.testMissingConstants(TrimMaterial.class, Registries.TRIM_MATERIAL); + } + + @Test + public void testTrimPattern() { +- this.testExcessConstants(TrimPattern.class, Registry.TRIM_PATTERN); ++ this.testExcessConstants(TrimPattern.class, org.bukkit.Registry.TRIM_PATTERN); // Paper - remap fix + this.testMissingConstants(TrimPattern.class, Registries.TRIM_PATTERN); + } + +- private void testExcessConstants(Class clazz, Registry registry) { ++ private void testExcessConstants(Class clazz, org.bukkit.Registry registry) { // Paper - remap fix + List excessKeys = new ArrayList<>(); + + for (Field field : clazz.getFields()) { +diff --git a/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java b/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java ++++ b/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java +@@ -0,0 +0,0 @@ public class RegistryLoadOrderTest extends AbstractTestingBase { + + private static boolean initInterface = false; + private static boolean initAbstract = false; +- private static Registry registry; ++ private static org.bukkit.Registry registry; // Paper - remap fix + + public static Stream data() { + return Stream.of( diff --git a/patches/server/Test-changes.patch b/patches/server/Test-changes.patch index 2c05e96619..09f135a330 100644 --- a/patches/server/Test-changes.patch +++ b/patches/server/Test-changes.patch @@ -102,8 +102,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/test/java/org/bukkit/support/DummyServer.java +++ b/src/test/java/org/bukkit/support/DummyServer.java @@ -0,0 +0,0 @@ public final class DummyServer { - - when(instance.getRegistry(any())).then(mock -> CraftRegistry.createRegistry(mock.getArgument(0), AbstractTestingBase.REGISTRY_CUSTOM)); + return registers.computeIfAbsent(aClass, key -> CraftRegistry.createRegistry(aClass, AbstractTestingBase.REGISTRY_CUSTOM)); + }); + // Paper start - testing additions + final Thread currentThread = Thread.currentThread(); diff --git a/work/Bukkit b/work/Bukkit index 63c208dd3f..1d5228782e 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 63c208dd3f16a0874b5e21348c35ce9e5c829d03 +Subproject commit 1d5228782e11c20c984621d26ea05822e46b3d3f diff --git a/work/CraftBukkit b/work/CraftBukkit index 771182f70c..292ec79e09 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 771182f70cd789f3d220cfef80876845a48ebec5 +Subproject commit 292ec79e09e3b90358560dd9e571452c9da7500f diff --git a/work/Spigot b/work/Spigot index 864e4acc0d..c198da22a8 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 864e4acc0db6ad9899f269740823a23d082d18d0 +Subproject commit c198da22a814a0ba9c3128c3a9946286e0839b5a