diff options
author | Jake Potrebic <[email protected]> | 2023-09-24 16:05:05 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2023-09-25 09:05:05 +1000 |
commit | 298c47857ba33c6d2e42ece4e85b3ed4143298e8 (patch) | |
tree | 303bac0cf8b3117613f7836f980a2d737e49cb18 | |
parent | 3cf03fc31afa6b577abea5a9a2bea6579994516f (diff) | |
download | Paper-298c47857ba33c6d2e42ece4e85b3ed4143298e8.tar.gz Paper-298c47857ba33c6d2e42ece4e85b3ed4143298e8.zip |
Fix tests that broke during the junit 5 update (#9757)
Co-authored-by: Jason Penilla <[email protected]>
40 files changed, 176 insertions, 157 deletions
diff --git a/patches/api/0001-Convert-project-to-Gradle.patch b/patches/api/0001-Convert-project-to-Gradle.patch index 1a1da14253..65d96647ff 100644 --- a/patches/api/0001-Convert-project-to-Gradle.patch +++ b/patches/api/0001-Convert-project-to-Gradle.patch @@ -27,10 +27,10 @@ index 11038da2e071699d6561a331565db0c8d7850d0e..317acfec5894101294a55abff6181943 +/.factorypath diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 -index 0000000000000000000000000000000000000000..1e8a4a87f963a8cf0e61e3c06925b864b437f8f5 +index 0000000000000000000000000000000000000000..41e77b687df6480adf8f5e21daad105dab208df2 --- /dev/null +++ b/build.gradle.kts -@@ -0,0 +1,87 @@ +@@ -0,0 +1,91 @@ +plugins { + `java-library` + `maven-publish` @@ -118,6 +118,10 @@ index 0000000000000000000000000000000000000000..1e8a4a87f963a8cf0e61e3c06925b864 + } + } +} ++ ++tasks.test { ++ useJUnitPlatform() ++} diff --git a/pom.xml b/pom.xml deleted file mode 100644 index e31246ebbe2af2950d63ad413460ea7c0c6baa36..0000000000000000000000000000000000000000 diff --git a/patches/api/0002-Build-system-changes.patch b/patches/api/0002-Build-system-changes.patch index 0dec8cc5b3..15840afd0e 100644 --- a/patches/api/0002-Build-system-changes.patch +++ b/patches/api/0002-Build-system-changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Build system changes diff --git a/build.gradle.kts b/build.gradle.kts -index 1e8a4a87f963a8cf0e61e3c06925b864b437f8f5..048dc1ffa90672a00f61da0271a550f9e877e8cd 100644 +index 41e77b687df6480adf8f5e21daad105dab208df2..d86ee6acb78d249424c5df98a851178c0f62eec1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,15 +18,27 @@ dependencies { @@ -51,9 +51,9 @@ index 1e8a4a87f963a8cf0e61e3c06925b864b437f8f5..048dc1ffa90672a00f61da0271a550f9 ) options.tags("apiNote:a:API Note:") -@@ -85,3 +101,14 @@ tasks.withType<Javadoc> { - } - } +@@ -89,3 +105,14 @@ tasks.withType<Javadoc> { + tasks.test { + useJUnitPlatform() } + +// Paper start diff --git a/patches/api/0003-Test-changes.patch b/patches/api/0003-Test-changes.patch index a0c783657f..3bef4c7cdf 100644 --- a/patches/api/0003-Test-changes.patch +++ b/patches/api/0003-Test-changes.patch @@ -3,7 +3,6 @@ From: Shane Freeder <[email protected]> Date: Sun, 17 Mar 2019 23:04:30 +0000 Subject: [PATCH] Test changes -- convert to mockito for mocking of types - Allow use of TYPE_USE annotations - Ignore package-private methods for nullability annotations - Add excludes for classes which don't pass @@ -12,6 +11,23 @@ Subject: [PATCH] Test changes Co-authored-by: Riley Park <[email protected]> Co-authored-by: Jake Potrebic <[email protected]> +diff --git a/build.gradle.kts b/build.gradle.kts +index d86ee6acb78d249424c5df98a851178c0f62eec1..75bfb0ab8049ebbb52240abf661d469de5526767 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -106,6 +106,12 @@ tasks.test { + useJUnitPlatform() + } + ++// Paper start - compile tests with -parameters for better junit parameterized test names ++tasks.compileTestJava { ++ options.compilerArgs.add("-parameters") ++} ++// Paper end ++ + // Paper start + val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) { + badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;") diff --git a/src/test/java/io/papermc/paper/testing/EmptyTag.java b/src/test/java/io/papermc/paper/testing/EmptyTag.java new file mode 100644 index 0000000000000000000000000000000000000000..77154095cfb8b259bdb318e8ff40cb6f559ebc18 @@ -205,17 +221,46 @@ index 64e7aef6220097edefdff3b98a771b988365930d..abadff47166722fdc756afdbc6ac7242 return false; } diff --git a/src/test/java/org/bukkit/BukkitMirrorTest.java b/src/test/java/org/bukkit/BukkitMirrorTest.java -index 89ca06ebecdaadd5dfc7bc74473ca15ad36f6eff..a07d35a6615e788361ac4c8b8954a2876d1306b2 100644 +index 89ca06ebecdaadd5dfc7bc74473ca15ad36f6eff..0970bcdf094a2026168b574848e4f7045e80db74 100644 --- a/src/test/java/org/bukkit/BukkitMirrorTest.java +++ b/src/test/java/org/bukkit/BukkitMirrorTest.java -@@ -12,6 +12,7 @@ import org.junit.jupiter.params.provider.MethodSource; - public class BukkitMirrorTest { - - public static Stream<Arguments> data() { -+ if (true) return Stream.of(); // Paper - return Stream.of(Server.class.getDeclaredMethods()) - .map(method -> { - try { +@@ -28,18 +28,21 @@ public class BukkitMirrorTest { + + @ParameterizedTest + @MethodSource("data") ++ @org.junit.jupiter.api.Disabled // Paper + public void isStatic(Method server, String name, Method bukkit) throws Throwable { + assertThat(Modifier.isStatic(bukkit.getModifiers()), is(true)); + } + + @ParameterizedTest + @MethodSource("data") ++ @org.junit.jupiter.api.Disabled // Paper + public void isDeprecated(Method server, String name, Method bukkit) throws Throwable { + assertThat(bukkit.isAnnotationPresent(Deprecated.class), is(server.isAnnotationPresent(Deprecated.class))); + } + + @ParameterizedTest + @MethodSource("data") ++ @org.junit.jupiter.api.Disabled // Paper + public void returnType(Method server, String name, Method bukkit) throws Throwable { + assertThat(bukkit.getReturnType(), is((Object) server.getReturnType())); + // assertThat(bukkit.getGenericReturnType(), is(server.getGenericReturnType())); // too strict on <T> type generics +@@ -47,12 +50,14 @@ public class BukkitMirrorTest { + + @ParameterizedTest + @MethodSource("data") ++ @org.junit.jupiter.api.Disabled // Paper + public void parameterTypes(Method server, String name, Method bukkit) throws Throwable { + // assertThat(bukkit.getGenericParameterTypes(), is(server.getGenericParameterTypes())); // too strict on <T> type generics + } + + @ParameterizedTest + @MethodSource("data") ++ @org.junit.jupiter.api.Disabled // Paper + public void declaredException(Method server, String name, Method bukkit) throws Throwable { + assertThat(bukkit.getGenericExceptionTypes(), is(server.getGenericExceptionTypes())); + } diff --git a/src/test/java/org/bukkit/support/TestServer.java b/src/test/java/org/bukkit/support/TestServer.java index 79173d6ed844f1e640e3aa745a9b560ec5e6a2bc..73ec679ac0d1f398b417bd174b47f9af93351e27 100644 --- a/src/test/java/org/bukkit/support/TestServer.java diff --git a/patches/api/0004-Add-FastUtil-to-Bukkit.patch b/patches/api/0004-Add-FastUtil-to-Bukkit.patch index 1bc6cc7d36..2498686f3c 100644 --- a/patches/api/0004-Add-FastUtil-to-Bukkit.patch +++ b/patches/api/0004-Add-FastUtil-to-Bukkit.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add FastUtil to Bukkit Doesn't expose to plugins, just allows Paper-API to use it for optimization diff --git a/build.gradle.kts b/build.gradle.kts -index 048dc1ffa90672a00f61da0271a550f9e877e8cd..98d7bca03ee3805a1d32f3eb7dc520d88cb1787a 100644 +index 75bfb0ab8049ebbb52240abf661d469de5526767..ecba866b84bc5f86a442bf220ab24ed8706aadf9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,6 +22,7 @@ dependencies { diff --git a/patches/api/0005-Adventure.patch b/patches/api/0005-Adventure.patch index 40645ed743..69687107e6 100644 --- a/patches/api/0005-Adventure.patch +++ b/patches/api/0005-Adventure.patch @@ -7,7 +7,7 @@ Co-authored-by: zml <[email protected]> Co-authored-by: Jake Potrebic <[email protected]> diff --git a/build.gradle.kts b/build.gradle.kts -index 98d7bca03ee3805a1d32f3eb7dc520d88cb1787a..b649f81d11c043649fa3e6e65ebd5dd70d2e9469 100644 +index ecba866b84bc5f86a442bf220ab24ed8706aadf9..2377d476aee8c88d26ca715fdb756dc97749aac8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,12 +10,24 @@ java { diff --git a/patches/api/0007-Use-ASM-for-event-executors.patch b/patches/api/0007-Use-ASM-for-event-executors.patch index 8a41b85faa..1bf57e8a2d 100644 --- a/patches/api/0007-Use-ASM-for-event-executors.patch +++ b/patches/api/0007-Use-ASM-for-event-executors.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use ASM for event executors. Uses method handles for private or static methods. diff --git a/build.gradle.kts b/build.gradle.kts -index b649f81d11c043649fa3e6e65ebd5dd70d2e9469..df783fda358889a23e9219b364181c626ff3dfea 100644 +index 2377d476aee8c88d26ca715fdb756dc97749aac8..0c6e0bb90fe5ea29c467323a179a47ec122ba0f6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -42,6 +42,9 @@ dependencies { diff --git a/patches/api/0008-Paper-Plugins.patch b/patches/api/0008-Paper-Plugins.patch index 82a448bd28..4b8401f996 100644 --- a/patches/api/0008-Paper-Plugins.patch +++ b/patches/api/0008-Paper-Plugins.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Paper Plugins diff --git a/build.gradle.kts b/build.gradle.kts -index df783fda358889a23e9219b364181c626ff3dfea..d3a55d64623b2421740da4eb6ebb08cca56a05e8 100644 +index 0c6e0bb90fe5ea29c467323a179a47ec122ba0f6..145f6209a984e74da2d2de03cf725c06c77ef8da 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -47,7 +47,7 @@ dependencies { diff --git a/patches/api/0069-Allow-plugins-to-use-SLF4J-for-logging.patch b/patches/api/0069-Allow-plugins-to-use-SLF4J-for-logging.patch index 15223a0c2a..b530e27068 100644 --- a/patches/api/0069-Allow-plugins-to-use-SLF4J-for-logging.patch +++ b/patches/api/0069-Allow-plugins-to-use-SLF4J-for-logging.patch @@ -14,7 +14,7 @@ it without having to shade it in the plugin and going through several layers of logging abstraction. diff --git a/build.gradle.kts b/build.gradle.kts -index d3a55d64623b2421740da4eb6ebb08cca56a05e8..afe9e9b08499ac504f4198ffb8da34cd286a6b44 100644 +index 145f6209a984e74da2d2de03cf725c06c77ef8da..639651972fddce4dff63a0f0a7e566a15b9e2dd6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,6 +11,8 @@ java { diff --git a/patches/server/0001-Setup-Gradle-project.patch b/patches/server/0001-Setup-Gradle-project.patch index 770cfecb0e..9f400e92ea 100644 --- a/patches/server/0001-Setup-Gradle-project.patch +++ b/patches/server/0001-Setup-Gradle-project.patch @@ -28,10 +28,10 @@ index 3df8c60ab5cd1454660980883f80668d535b742b..37c3a00659ce21623be07317f4f6a45b +/.factorypath diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 -index 0000000000000000000000000000000000000000..398df317e5a84e8916a86209e10c127e23bdd563 +index 0000000000000000000000000000000000000000..813e9019e5bd487edfbb7a52592f979419fee0b5 --- /dev/null +++ b/build.gradle.kts -@@ -0,0 +1,138 @@ +@@ -0,0 +1,139 @@ +import io.papermc.paperweight.util.* + +plugins { @@ -111,6 +111,7 @@ index 0000000000000000000000000000000000000000..398df317e5a84e8916a86209e10c127e + +tasks.test { + exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class") ++ useJUnitPlatform() +} + +fun TaskContainer.registerRunTask( diff --git a/patches/server/0003-Build-system-changes.patch b/patches/server/0003-Build-system-changes.patch index 06f4d093fa..2d6f516053 100644 --- a/patches/server/0003-Build-system-changes.patch +++ b/patches/server/0003-Build-system-changes.patch @@ -9,7 +9,7 @@ public net.minecraft.server.packs.VanillaPackResourcesBuilder safeGetPath(Ljava/ Co-authored-by: Jake Potrebic <[email protected]> diff --git a/build.gradle.kts b/build.gradle.kts -index 398df317e5a84e8916a86209e10c127e23bdd563..09bd31c939125f97d7e9ebb2b0376af70a035ab0 100644 +index 813e9019e5bd487edfbb7a52592f979419fee0b5..0ced1beb116b1dc43a79415aa154d32cb22d23d0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,10 +9,9 @@ plugins { @@ -81,8 +81,8 @@ index 398df317e5a84e8916a86209e10c127e23bdd563..09bd31c939125f97d7e9ebb2b0376af7 + tasks.test { exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class") - } -@@ -132,7 +153,14 @@ tasks.registerRunTask("runReobf") { + useJUnitPlatform() +@@ -133,7 +154,14 @@ tasks.registerRunTask("runReobf") { classpath(runtimeClasspathWithoutVanillaServer) } diff --git a/patches/server/0004-Test-changes.patch b/patches/server/0004-Test-changes.patch index 59928f2c5a..e9fa837f46 100644 --- a/patches/server/0004-Test-changes.patch +++ b/patches/server/0004-Test-changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Test changes diff --git a/build.gradle.kts b/build.gradle.kts -index 09bd31c939125f97d7e9ebb2b0376af70a035ab0..46089768685b3bdb0620571de6ce81a17c00f5d5 100644 +index 0ced1beb116b1dc43a79415aa154d32cb22d23d0..067440c8cb05bee3539303716a93a4369849a5af 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,6 +12,7 @@ dependencies { @@ -16,12 +16,25 @@ index 09bd31c939125f97d7e9ebb2b0376af70a035ab0..46089768685b3bdb0620571de6ce81a1 implementation("commons-lang:commons-lang:2.6") runtimeOnly("org.xerial:sqlite-jdbc:3.43.0.0") runtimeOnly("com.mysql:mysql-connector-j:8.1.0") +@@ -59,6 +60,12 @@ tasks.compileJava { + options.setIncremental(false) + } + ++// Paper start - compile tests with -parameters for better junit parameterized test names ++tasks.compileTestJava { ++ options.compilerArgs.add("-parameters") ++} ++// Paper end ++ + publishing { + publications.create<MavenPublication>("maven") { + artifact(tasks.shadowJar) diff --git a/src/test/java/io/papermc/paper/testing/DummyServer.java b/src/test/java/io/papermc/paper/testing/DummyServer.java new file mode 100644 -index 0000000000000000000000000000000000000000..e944e9dca13883c57e93e480ae5adfe51c342532 +index 0000000000000000000000000000000000000000..fd40d6818fe6b511a57f60896cf523a5e871af64 --- /dev/null +++ b/src/test/java/io/papermc/paper/testing/DummyServer.java -@@ -0,0 +1,67 @@ +@@ -0,0 +1,66 @@ +package io.papermc.paper.testing; + +import java.util.logging.Logger; @@ -78,8 +91,7 @@ index 0000000000000000000000000000000000000000..e944e9dca13883c57e93e480ae5adfe5 + }); + + when(dummyServer.getRegistry(any())).thenAnswer(invocation -> { -+ // LazyRegistry because the vanilla data hasn't been bootstrapped yet. -+ return new LazyRegistry(() -> CraftRegistry.createRegistry(invocation.getArgument(0, Class.class), AbstractTestingBase.REGISTRY_CUSTOM)); ++ return CraftRegistry.createRegistry(invocation.getArgument(0), org.bukkit.support.AbstractTestingBase.REGISTRY_CUSTOM); + }); + + final PluginManager pluginManager = new SimplePluginManager(dummyServer, new SimpleCommandMap(dummyServer)); @@ -89,42 +101,6 @@ index 0000000000000000000000000000000000000000..e944e9dca13883c57e93e480ae5adfe5 + + } +} -diff --git a/src/test/java/io/papermc/paper/testing/LazyRegistry.java b/src/test/java/io/papermc/paper/testing/LazyRegistry.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c88749e839ee1a9cf8439c4218c8a98afbd9c491 ---- /dev/null -+++ b/src/test/java/io/papermc/paper/testing/LazyRegistry.java -@@ -0,0 +1,30 @@ -+package io.papermc.paper.testing; -+ -+import java.util.Iterator; -+import java.util.function.Supplier; -+import java.util.stream.Stream; -+import java.util.stream.StreamSupport; -+import org.bukkit.Keyed; -+import org.bukkit.NamespacedKey; -+import org.bukkit.Registry; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+public record LazyRegistry(Supplier<Registry<Keyed>> supplier) implements Registry<Keyed> { -+ -+ @NotNull -+ @Override -+ public Iterator<Keyed> iterator() { -+ return this.supplier().get().iterator(); -+ } -+ -+ @Override -+ public @Nullable Keyed get(@NotNull final NamespacedKey key) { -+ return this.supplier().get().get(key); -+ } -+ -+ @Override -+ public @NotNull Stream<Keyed> stream() { -+ return StreamSupport.stream(this.supplier.get().spliterator(), false); -+ } -+} diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java index c3c0dff6497ba47604c29a9ff7bcc4692e9ba757..bedb1c43fd9d27eda2411e23d46eb1ad96429507 100644 --- a/src/test/java/org/bukkit/support/AbstractTestingBase.java diff --git a/patches/server/0005-Paper-config-files.patch b/patches/server/0005-Paper-config-files.patch index 90fc737a6d..9e319ed276 100644 --- a/patches/server/0005-Paper-config-files.patch +++ b/patches/server/0005-Paper-config-files.patch @@ -15,7 +15,7 @@ public net.minecraft.server.dedicated.DedicatedServerProperties reload(Lnet/mine public net.minecraft.world.level.NaturalSpawner SPAWNING_CATEGORIES diff --git a/build.gradle.kts b/build.gradle.kts -index 46089768685b3bdb0620571de6ce81a17c00f5d5..4dfc25fce6ec712838b2a080a649e5c718750a74 100644 +index 067440c8cb05bee3539303716a93a4369849a5af..82562c36460ae14aff6a2fafceeee36eddd8558a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,6 +13,7 @@ dependencies { diff --git a/patches/server/0013-Paper-Plugins.patch b/patches/server/0013-Paper-Plugins.patch index f601664a84..c12b8b945a 100644 --- a/patches/server/0013-Paper-Plugins.patch +++ b/patches/server/0013-Paper-Plugins.patch @@ -7892,11 +7892,11 @@ index 0000000000000000000000000000000000000000..ba271c35eb2804f94cfc893bf94affb9 + } +} diff --git a/src/test/java/io/papermc/paper/testing/DummyServer.java b/src/test/java/io/papermc/paper/testing/DummyServer.java -index e944e9dca13883c57e93e480ae5adfe51c342532..f482cb4dc5394de3cf88b4c4e13c18f9c61caf45 100644 +index fd40d6818fe6b511a57f60896cf523a5e871af64..88894731a6a21d74ce78d15c16e34d8a363f39cf 100644 --- a/src/test/java/io/papermc/paper/testing/DummyServer.java +++ b/src/test/java/io/papermc/paper/testing/DummyServer.java -@@ -58,7 +58,7 @@ public final class DummyServer { - return new LazyRegistry(() -> CraftRegistry.createRegistry(invocation.getArgument(0, Class.class), AbstractTestingBase.REGISTRY_CUSTOM)); +@@ -57,7 +57,7 @@ public final class DummyServer { + return CraftRegistry.createRegistry(invocation.getArgument(0), org.bukkit.support.AbstractTestingBase.REGISTRY_CUSTOM); }); - final PluginManager pluginManager = new SimplePluginManager(dummyServer, new SimpleCommandMap(dummyServer)); diff --git a/patches/server/0134-Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/0134-Use-TerminalConsoleAppender-for-console-improvements.patch index 32551c2e0e..b8494e6e24 100644 --- a/patches/server/0134-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/0134-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -25,7 +25,7 @@ Other changes: Co-Authored-By: Emilia Kond <[email protected]> diff --git a/build.gradle.kts b/build.gradle.kts -index 4dfc25fce6ec712838b2a080a649e5c718750a74..90d61ecdc0760bd81a18fa1d539190853f8da5a3 100644 +index 82562c36460ae14aff6a2fafceeee36eddd8558a..e7ed61452ae5c33078e196cabc648ff39d0e5c23 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,9 +6,30 @@ plugins { @@ -60,7 +60,7 @@ index 4dfc25fce6ec712838b2a080a649e5c718750a74..90d61ecdc0760bd81a18fa1d53919085 implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion implementation("org.ow2.asm:asm:9.5") implementation("org.ow2.asm:asm-commons:9.5") // Paper - ASM event executor generation -@@ -75,7 +96,7 @@ relocation { +@@ -81,7 +102,7 @@ relocation { } tasks.shadowJar { diff --git a/patches/server/0147-Implement-ensureServerConversions-API.patch b/patches/server/0147-Implement-ensureServerConversions-API.patch index 2ea064c942..c78817409b 100644 --- a/patches/server/0147-Implement-ensureServerConversions-API.patch +++ b/patches/server/0147-Implement-ensureServerConversions-API.patch @@ -6,6 +6,19 @@ Subject: [PATCH] Implement ensureServerConversions API This will take a Bukkit ItemStack and run it through any conversions a server process would perform on it, to ensure it meets latest minecraft expectations. +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index cae548dbb5a3027e2de0bfbe38918ec7c2803e8e..c95c51605ae75cf340c7b0a88ae9146d8b31063e 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -206,7 +206,7 @@ public final class ItemStack { + + // Called to run this stack through the data converter to handle older storage methods and serialized items + public void convertStack(int version) { +- if (0 < version && version < CraftMagicNumbers.INSTANCE.getDataVersion()) { ++ if (0 < version && version < CraftMagicNumbers.INSTANCE.getDataVersion() && MinecraftServer.getServer() != null) { // Paper - skip conversion if the server doesn't exist (for tests) + CompoundTag savedStack = new CompoundTag(); + this.save(savedStack); + savedStack = (CompoundTag) MinecraftServer.getServer().fixerUpper.update(References.ITEM_STACK, new Dynamic(NbtOps.INSTANCE, savedStack), version, CraftMagicNumbers.INSTANCE.getDataVersion()).getValue(); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java index 2fa36de5d43e2c395e0db2017bd994a62a5b2feb..0bd3a2989be4e158ba343da09914328e819a0f89 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java diff --git a/patches/server/0155-Handle-plugin-prefixes-using-Log4J-configuration.patch b/patches/server/0155-Handle-plugin-prefixes-using-Log4J-configuration.patch index 51775c22e3..d739f5f771 100644 --- a/patches/server/0155-Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/patches/server/0155-Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -15,7 +15,7 @@ This may cause additional prefixes to be disabled for plugins bypassing the plugin logger. diff --git a/build.gradle.kts b/build.gradle.kts -index 90d61ecdc0760bd81a18fa1d539190853f8da5a3..c06ed62fb6ce79cd8c1ed45fb4d61a0ded21a01f 100644 +index e7ed61452ae5c33078e196cabc648ff39d0e5c23..d2dbc66c9981f5b9d4fe445c19e387d10c7368dc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,7 +25,7 @@ dependencies { diff --git a/patches/server/0162-Add-PlayerArmorChangeEvent.patch b/patches/server/0162-Add-PlayerArmorChangeEvent.patch index a912c660b0..a28cf4298e 100644 --- a/patches/server/0162-Add-PlayerArmorChangeEvent.patch +++ b/patches/server/0162-Add-PlayerArmorChangeEvent.patch @@ -29,12 +29,12 @@ index a8d39b7257332ec8b3b711aab2c4b76a867e73bc..231ba23fabeb88b659a7ea9702eebe4a if (map == null) { map = Maps.newEnumMap(EquipmentSlot.class); } -diff --git a/src/test/java/io/papermc/paper/inventory/item/ExtraArmorSlotTypeMaterialTest.java b/src/test/java/io/papermc/paper/inventory/item/ExtraArmorSlotTypeMaterialTest.java +diff --git a/src/test/java/io/papermc/paper/inventory/item/ArmorSlotTypeMaterialTest.java b/src/test/java/io/papermc/paper/inventory/item/ArmorSlotTypeMaterialTest.java new file mode 100644 -index 0000000000000000000000000000000000000000..0d99bef54594f9c5eda5c19063be765783e89fdd +index 0000000000000000000000000000000000000000..a706dcbabfe31bf54a552965fa5feb8be34213bf --- /dev/null -+++ b/src/test/java/io/papermc/paper/inventory/item/ExtraArmorSlotTypeMaterialTest.java -@@ -0,0 +1,47 @@ ++++ b/src/test/java/io/papermc/paper/inventory/item/ArmorSlotTypeMaterialTest.java +@@ -0,0 +1,74 @@ +package io.papermc.paper.inventory.item; + +import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; @@ -53,11 +53,11 @@ index 0000000000000000000000000000000000000000..0d99bef54594f9c5eda5c19063be7657 + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; ++import static org.junit.jupiter.api.Assertions.assertTrue; + -+public class ExtraArmorSlotTypeMaterialTest extends AbstractTestingBase { ++public class ArmorSlotTypeMaterialTest extends AbstractTestingBase { + -+ @MethodSource("parameters") -+ public static Stream<Object[]> parameters() { ++ public static Stream<Object[]> slotTypeParams() { + final List<Object[]> parameters = new ArrayList<>(); + for (final PlayerArmorChangeEvent.SlotType slotType : PlayerArmorChangeEvent.SlotType.values()) { + for (final Material item : slotType.getTypes()) { @@ -67,9 +67,9 @@ index 0000000000000000000000000000000000000000..0d99bef54594f9c5eda5c19063be7657 + return parameters.stream(); + } + -+ @ParameterizedTest -+ @MethodSource("parameters") -+ public void test(PlayerArmorChangeEvent.SlotType slotType, Material item) { ++ @ParameterizedTest(name = "{argumentsWithNames}") ++ @MethodSource("slotTypeParams") ++ public void testSlotType(PlayerArmorChangeEvent.SlotType slotType, Material item) { + final Item nmsItem = CraftMagicNumbers.getItem(item); + final Equipable equipable = Equipable.get(new ItemStack(nmsItem)); + assertNotNull(equipable, item + " isn't equipable"); @@ -81,40 +81,10 @@ index 0000000000000000000000000000000000000000..0d99bef54594f9c5eda5c19063be7657 + }; + assertEquals(equipable.getEquipmentSlot(), slot, item + " isn't set to the right slot"); + } -+} -diff --git a/src/test/java/io/papermc/paper/inventory/item/MissingArmorSlotTypeMaterialTest.java b/src/test/java/io/papermc/paper/inventory/item/MissingArmorSlotTypeMaterialTest.java -new file mode 100644 -index 0000000000000000000000000000000000000000..f2a9515228e4e3af27fce4f30fa4f4a5f0629a1e ---- /dev/null -+++ b/src/test/java/io/papermc/paper/inventory/item/MissingArmorSlotTypeMaterialTest.java -@@ -0,0 +1,51 @@ -+package io.papermc.paper.inventory.item; -+ -+import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; -+import java.util.ArrayList; -+import java.util.List; -+import java.util.stream.Stream; -+import net.minecraft.core.registries.BuiltInRegistries; -+import net.minecraft.world.entity.EquipmentSlot; -+import net.minecraft.world.item.Equipable; -+import net.minecraft.world.item.Item; -+import net.minecraft.world.item.ItemStack; -+import org.bukkit.craftbukkit.util.CraftMagicNumbers; -+import org.bukkit.support.AbstractTestingBase; -+import org.junit.jupiter.params.ParameterizedTest; -+import org.junit.jupiter.params.provider.MethodSource; -+ -+import static org.junit.jupiter.api.Assertions.assertTrue; -+ -+/** -+ * Test for {@link com.destroystokyo.paper.event.player.PlayerArmorChangeEvent.SlotType} -+ */ -+public class MissingArmorSlotTypeMaterialTest extends AbstractTestingBase { + -+ @MethodSource("parameters") -+ public static Stream<Object[]> parameters() { ++ public static Stream<Object[]> equipableParams() { + final List<Object[]> parameters = new ArrayList<>(); -+ for (final Item item : BuiltInRegistries.ITEM) { ++ for (final Item item : net.minecraft.core.registries.BuiltInRegistries.ITEM) { + final Equipable equipable = Equipable.get(new ItemStack(item)); + if (equipable != null) { + parameters.add(new Object[]{equipable, item}); @@ -123,9 +93,9 @@ index 0000000000000000000000000000000000000000..f2a9515228e4e3af27fce4f30fa4f4a5 + return parameters.stream(); + } + -+ @ParameterizedTest -+ @MethodSource("parameters") -+ public void test(Equipable equipable, Item item) { ++ @ParameterizedTest(name = "{argumentsWithNames}") ++ @MethodSource("equipableParams") ++ public void testEquipable(Equipable equipable, Item item) { + final EquipmentSlot equipmentSlot = equipable.getEquipmentSlot(); + PlayerArmorChangeEvent.SlotType slotType = switch (equipmentSlot) { + case HEAD -> PlayerArmorChangeEvent.SlotType.HEAD; diff --git a/patches/server/0219-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch b/patches/server/0219-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch index 32007ca4fc..246784575d 100644 --- a/patches/server/0219-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch +++ b/patches/server/0219-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use AsyncAppender to keep logging IO off main thread diff --git a/build.gradle.kts b/build.gradle.kts -index c06ed62fb6ce79cd8c1ed45fb4d61a0ded21a01f..b092384b34986b0826fa62530ffaeb0fcd80cdc6 100644 +index d2dbc66c9981f5b9d4fe445c19e387d10c7368dc..21a94671e77cd72dabcf76c26b12d3ccbe23a9dd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -38,6 +38,7 @@ dependencies { diff --git a/patches/server/0254-Allow-chests-to-be-placed-with-NBT-data.patch b/patches/server/0254-Allow-chests-to-be-placed-with-NBT-data.patch index 348aba5a8b..ee56f10dfd 100644 --- a/patches/server/0254-Allow-chests-to-be-placed-with-NBT-data.patch +++ b/patches/server/0254-Allow-chests-to-be-placed-with-NBT-data.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow chests to be placed with NBT data diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index cae548dbb5a3027e2de0bfbe38918ec7c2803e8e..77db59d433d4189f96b9da006898bded5edbb0ba 100644 +index c95c51605ae75cf340c7b0a88ae9146d8b31063e..877951fd07dece86fa59aee6f38a787722756688 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -386,6 +386,7 @@ public final class ItemStack { diff --git a/patches/server/0295-Implement-Brigadier-Mojang-API.patch b/patches/server/0295-Implement-Brigadier-Mojang-API.patch index 66521666d3..0743b58dcf 100644 --- a/patches/server/0295-Implement-Brigadier-Mojang-API.patch +++ b/patches/server/0295-Implement-Brigadier-Mojang-API.patch @@ -10,7 +10,7 @@ Adds CommandRegisteredEvent - Allows manipulating the CommandNode to add more children/metadata for the client diff --git a/build.gradle.kts b/build.gradle.kts -index b092384b34986b0826fa62530ffaeb0fcd80cdc6..5ecadb31e64964f5706cc4bf0f4fd98195388116 100644 +index 21a94671e77cd72dabcf76c26b12d3ccbe23a9dd..5cf067ce5010ff5fbbe010555b62dc57268e2a47 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,6 +14,7 @@ val alsoShade: Configuration by configurations.creating diff --git a/patches/server/0376-Implement-Player-Client-Options-API.patch b/patches/server/0376-Implement-Player-Client-Options-API.patch index f7a6f6ecec..3670427b7c 100644 --- a/patches/server/0376-Implement-Player-Client-Options-API.patch +++ b/patches/server/0376-Implement-Player-Client-Options-API.patch @@ -149,7 +149,7 @@ index 94cb3513aeef549da3626ff18c1ea0662252ecb9..f4a15de92c3af88624f337c36fadbea6 @Override diff --git a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java new file mode 100644 -index 0000000000000000000000000000000000000000..825a98cf66d293ef90f33b2fe4a23f6bd9f100fa +index 0000000000000000000000000000000000000000..7f8b6462d2a1bbd39a870d2543bebc135f7eb45b --- /dev/null +++ b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java @@ -0,0 +1,18 @@ @@ -167,7 +167,7 @@ index 0000000000000000000000000000000000000000..825a98cf66d293ef90f33b2fe4a23f6b + public void testChatVisibilityKeys() { + for (ClientOption.ChatVisibility chatVisibility : ClientOption.ChatVisibility.values()) { + if (chatVisibility == ClientOption.ChatVisibility.UNKNOWN) continue; -+ Assertions.assertEquals(chatVisibility + "'s translation key doesn't match", ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey()); ++ Assertions.assertEquals(ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey(), chatVisibility + "'s translation key doesn't match"); + } + } +} diff --git a/patches/server/0391-Deobfuscate-stacktraces-in-log-messages-crash-report.patch b/patches/server/0391-Deobfuscate-stacktraces-in-log-messages-crash-report.patch index bcd4ce7e97..efcc6a867b 100644 --- a/patches/server/0391-Deobfuscate-stacktraces-in-log-messages-crash-report.patch +++ b/patches/server/0391-Deobfuscate-stacktraces-in-log-messages-crash-report.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Deobfuscate stacktraces in log messages, crash reports, and diff --git a/build.gradle.kts b/build.gradle.kts -index 5ecadb31e64964f5706cc4bf0f4fd98195388116..c26ae39f0d78a4a2427681d1c8fc60c19374155e 100644 +index 5cf067ce5010ff5fbbe010555b62dc57268e2a47..200b9cce4636892a233221665284815c30facbfe 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -37,6 +37,7 @@ dependencies { @@ -17,7 +17,7 @@ index 5ecadb31e64964f5706cc4bf0f4fd98195388116..c26ae39f0d78a4a2427681d1c8fc60c1 runtimeOnly("org.xerial:sqlite-jdbc:3.43.0.0") runtimeOnly("com.mysql:mysql-connector-j:8.1.0") runtimeOnly("com.lmax:disruptor:3.4.4") // Paper -@@ -121,6 +122,18 @@ tasks.check { +@@ -127,6 +128,18 @@ tasks.check { } // Paper end @@ -35,7 +35,7 @@ index 5ecadb31e64964f5706cc4bf0f4fd98195388116..c26ae39f0d78a4a2427681d1c8fc60c1 + tasks.test { exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class") - } + useJUnitPlatform() diff --git a/src/log4jPlugins/java/io/papermc/paper/logging/StacktraceDeobfuscatingRewritePolicy.java b/src/log4jPlugins/java/io/papermc/paper/logging/StacktraceDeobfuscatingRewritePolicy.java new file mode 100644 index 0000000000000000000000000000000000000000..66b6011ee3684695b2ab9292961c80bf2a420ee9 diff --git a/patches/server/0392-Implement-Mob-Goal-API.patch b/patches/server/0392-Implement-Mob-Goal-API.patch index 407479ef77..304b4ead69 100644 --- a/patches/server/0392-Implement-Mob-Goal-API.patch +++ b/patches/server/0392-Implement-Mob-Goal-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/build.gradle.kts b/build.gradle.kts -index c26ae39f0d78a4a2427681d1c8fc60c19374155e..ace5cd8aa4fc2a555673b75adb910a1ede3f57fc 100644 +index 200b9cce4636892a233221665284815c30facbfe..a4c39e1302dff6ec43e84e3d04f234733b81a85b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -46,6 +46,7 @@ dependencies { diff --git a/patches/server/0431-Update-itemstack-legacy-name-and-lore.patch b/patches/server/0431-Update-itemstack-legacy-name-and-lore.patch index cf9a5df397..2c58b8b314 100644 --- a/patches/server/0431-Update-itemstack-legacy-name-and-lore.patch +++ b/patches/server/0431-Update-itemstack-legacy-name-and-lore.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Update itemstack legacy name and lore diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 77db59d433d4189f96b9da006898bded5edbb0ba..8aaaa67549a75b7404d2865a09474dc2b6cf18fe 100644 +index 877951fd07dece86fa59aee6f38a787722756688..abaafcff3f7a5e710319c93313a4ecf9874b7ef8 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -172,6 +172,44 @@ public final class ItemStack { diff --git a/patches/server/0456-PortalCreateEvent-needs-to-know-its-entity.patch b/patches/server/0456-PortalCreateEvent-needs-to-know-its-entity.patch index 70e5553f18..f8591215a4 100644 --- a/patches/server/0456-PortalCreateEvent-needs-to-know-its-entity.patch +++ b/patches/server/0456-PortalCreateEvent-needs-to-know-its-entity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PortalCreateEvent needs to know its entity diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 8aaaa67549a75b7404d2865a09474dc2b6cf18fe..58eb562aea9d3d19da0958ce9dcf0474f975e259 100644 +index abaafcff3f7a5e710319c93313a4ecf9874b7ef8..a9707ecebb175663acb0f7285c759d938c5dae8b 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -457,7 +457,7 @@ public final class ItemStack { diff --git a/patches/server/0458-Add-methods-to-get-translation-keys.patch b/patches/server/0458-Add-methods-to-get-translation-keys.patch index 354d56749b..cc9ea76953 100644 --- a/patches/server/0458-Add-methods-to-get-translation-keys.patch +++ b/patches/server/0458-Add-methods-to-get-translation-keys.patch @@ -41,7 +41,7 @@ index e8334e2264510f5101e80b4f130e7ae1442560d7..57decf4156f176ebcc988478c17856cb public net.minecraft.world.item.enchantment.Enchantment getHandle() { diff --git a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java -index 825a98cf66d293ef90f33b2fe4a23f6bd9f100fa..8258a0bfff26a49935606b85b41bdb0b6a207aec 100644 +index 7f8b6462d2a1bbd39a870d2543bebc135f7eb45b..dbd1dc4453bd26fb6116b62f6ccbf69e92e09fc4 100644 --- a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java +++ b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java @@ -1,12 +1,27 @@ @@ -74,35 +74,35 @@ index 825a98cf66d293ef90f33b2fe4a23f6bd9f100fa..8258a0bfff26a49935606b85b41bdb0b @Test public void testChatVisibilityKeys() { @@ -15,4 +30,67 @@ public class TranslationKeyTest { - Assertions.assertEquals(chatVisibility + "'s translation key doesn't match", ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey()); + Assertions.assertEquals(ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey(), chatVisibility + "'s translation key doesn't match"); } } + + @Test + public void testDifficultyKeys() { + for (Difficulty bukkitDifficulty : Difficulty.values()) { -+ Assertions.assertEquals(bukkitDifficulty + "'s translation key doesn't match", ((TranslatableContents) net.minecraft.world.Difficulty.byId(bukkitDifficulty.ordinal()).getDisplayName().getContents()).getKey(), bukkitDifficulty.translationKey()); ++ Assertions.assertEquals(((TranslatableContents) net.minecraft.world.Difficulty.byId(bukkitDifficulty.ordinal()).getDisplayName().getContents()).getKey(), bukkitDifficulty.translationKey(), bukkitDifficulty + "'s translation key doesn't match"); + } + } + + @Test + public void testGameruleKeys() { + for (GameRule<?> rule : GameRule.values()) { -+ Assertions.assertEquals(rule.getName() + "'s translation doesn't match", org.bukkit.craftbukkit.CraftWorld.getGameRulesNMS().get(rule.getName()).getDescriptionId(), rule.translationKey()); ++ Assertions.assertEquals(org.bukkit.craftbukkit.CraftWorld.getGameRulesNMS().get(rule.getName()).getDescriptionId(), rule.translationKey(), rule.getName() + "'s translation doesn't match"); + } + } + + @Test + public void testAttributeKeys() { + for (Attribute attribute : Attribute.values()) { -+ Assertions.assertEquals("translation key mismatch for " + attribute, org.bukkit.craftbukkit.attribute.CraftAttribute.bukkitToMinecraft(attribute).getDescriptionId(), attribute.translationKey()); ++ Assertions.assertEquals(org.bukkit.craftbukkit.attribute.CraftAttribute.bukkitToMinecraft(attribute).getDescriptionId(), attribute.translationKey(), "translation key mismatch for " + attribute); + } + } + + @Test + public void testFireworkEffectType() { + for (FireworkEffect.Type type : FireworkEffect.Type.values()) { -+ Assertions.assertEquals("translation key mismatch for " + type, net.minecraft.world.item.FireworkRocketItem.Shape.byId(org.bukkit.craftbukkit.inventory.CraftMetaFirework.getNBT(type)).getName(), org.bukkit.FireworkEffect.Type.NAMES.key(type)); ++ Assertions.assertEquals(net.minecraft.world.item.FireworkRocketItem.Shape.byId(org.bukkit.craftbukkit.inventory.CraftMetaFirework.getNBT(type)).getName(), org.bukkit.FireworkEffect.Type.NAMES.key(type), "translation key mismatch for " + type); + } + } + @@ -120,7 +120,7 @@ index 825a98cf66d293ef90f33b2fe4a23f6bd9f100fa..8258a0bfff26a49935606b85b41bdb0b + for (GameType nms : GameType.values()) { + GameMode bukkit = GameMode.getByValue(nms.getId()); + Assertions.assertNotNull(bukkit); -+ Assertions.assertEquals("translation key mismatch for " + bukkit, ((TranslatableContents) nms.getLongDisplayName().getContents()).getKey(), bukkit.translationKey()); ++ Assertions.assertEquals(((TranslatableContents) nms.getLongDisplayName().getContents()).getKey(), bukkit.translationKey(), "translation key mismatch for " + bukkit); + } + } + @@ -128,7 +128,7 @@ index 825a98cf66d293ef90f33b2fe4a23f6bd9f100fa..8258a0bfff26a49935606b85b41bdb0b + public void testBiome() { + for (Map.Entry<ResourceKey<Biome>, Biome> nms : AbstractTestingBase.BIOMES.entrySet()) { + org.bukkit.block.Biome bukkit = org.bukkit.block.Biome.valueOf(nms.getKey().location().getPath().toUpperCase()); -+ Assertions.assertEquals("translation key mismatch for " + bukkit, nms.getKey().location().toLanguageKey("biome"), bukkit.translationKey()); ++ Assertions.assertEquals(nms.getKey().location().toLanguageKey("biome"), bukkit.translationKey(), "translation key mismatch for " + bukkit); + } + } + @@ -137,7 +137,7 @@ index 825a98cf66d293ef90f33b2fe4a23f6bd9f100fa..8258a0bfff26a49935606b85b41bdb0b + for (final ResourceLocation nms : BuiltInRegistries.INSTRUMENT.keySet()) { + final MusicInstrument bukkit = MusicInstrument.getByKey(CraftNamespacedKey.fromMinecraft(nms)); + Assertions.assertNotNull(bukkit, "Missing bukkit instrument for " + nms); -+ Assertions.assertEquals("translation key mismatch for " + bukkit, nms.toLanguageKey("instrument"), bukkit.translationKey()); ++ Assertions.assertEquals(nms.toLanguageKey("instrument"), bukkit.translationKey(), "translation key mismatch for " + bukkit); + } + } } diff --git a/patches/server/0533-Add-StructuresLocateEvent.patch b/patches/server/0533-Add-StructuresLocateEvent.patch index 5add42e4c3..9ad52d9134 100644 --- a/patches/server/0533-Add-StructuresLocateEvent.patch +++ b/patches/server/0533-Add-StructuresLocateEvent.patch @@ -193,3 +193,15 @@ index 0000000000000000000000000000000000000000..cc24d5746b96d8ac352a3ed0a675a7b1 + System.setOut(out); + } +} +diff --git a/src/test/java/org/bukkit/PerRegistryTest.java b/src/test/java/org/bukkit/PerRegistryTest.java +index a5db5b190bf16571d329a653de01acdae8dc8cfa..9e553a8858750c494456f04abd7bffd1d257308c 100644 +--- a/src/test/java/org/bukkit/PerRegistryTest.java ++++ b/src/test/java/org/bukkit/PerRegistryTest.java +@@ -33,6 +33,7 @@ public class PerRegistryTest extends AbstractTestingBase { + if (!(object instanceof CraftRegistry<?, ?> registry)) { + continue; + } ++ if (object instanceof io.papermc.paper.world.structure.PaperConfiguredStructure.LegacyRegistry) continue; // Paper - skip + + data.add(Arguments.of(registry)); + } catch (ReflectiveOperationException e) { diff --git a/patches/server/0650-Added-EntityDamageItemEvent.patch b/patches/server/0650-Added-EntityDamageItemEvent.patch index 0a1a008cae..935084ef4b 100644 --- a/patches/server/0650-Added-EntityDamageItemEvent.patch +++ b/patches/server/0650-Added-EntityDamageItemEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Added EntityDamageItemEvent diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 58eb562aea9d3d19da0958ce9dcf0474f975e259..d6f833583c6ae915133b055768d7fcb97680a640 100644 +index a9707ecebb175663acb0f7285c759d938c5dae8b..9eb6ad597a0e2605eae367038d7541fe538f9a86 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -601,7 +601,7 @@ public final class ItemStack { diff --git a/patches/server/0693-Use-Velocity-compression-and-cipher-natives.patch b/patches/server/0693-Use-Velocity-compression-and-cipher-natives.patch index 012817f2e2..e24e92a387 100644 --- a/patches/server/0693-Use-Velocity-compression-and-cipher-natives.patch +++ b/patches/server/0693-Use-Velocity-compression-and-cipher-natives.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use Velocity compression and cipher natives diff --git a/build.gradle.kts b/build.gradle.kts -index ace5cd8aa4fc2a555673b75adb910a1ede3f57fc..98bed6bb990ecb40be0e2b74ad40f84ab0ba3705 100644 +index a4c39e1302dff6ec43e84e3d04f234733b81a85b..a46a627d9fb07fa43c95ca9eb48ba87302f66173 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -41,6 +41,11 @@ dependencies { diff --git a/patches/server/0764-Fix-cancelled-powdered-snow-bucket-placement.patch b/patches/server/0764-Fix-cancelled-powdered-snow-bucket-placement.patch index bab29517f3..6c443ed789 100644 --- a/patches/server/0764-Fix-cancelled-powdered-snow-bucket-placement.patch +++ b/patches/server/0764-Fix-cancelled-powdered-snow-bucket-placement.patch @@ -20,7 +20,7 @@ index e581dc10f3c805f7f8b6e4c842092609e7e1a0f8..b0204af850ee182773ad458208cccd94 } return InteractionResult.FAIL; diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index d6f833583c6ae915133b055768d7fcb97680a640..710369e06f66c033dbfa551b0c00362009938e44 100644 +index 9eb6ad597a0e2605eae367038d7541fe538f9a86..e615c8b5c1142f547af77dafb33a8772ab5e13c3 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -358,7 +358,7 @@ public final class ItemStack { diff --git a/patches/server/0800-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch b/patches/server/0800-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch index a6543b31f3..676f145bb4 100644 --- a/patches/server/0800-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch +++ b/patches/server/0800-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add pre-unbreaking amount to PlayerItemDamageEvent diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 710369e06f66c033dbfa551b0c00362009938e44..fe153047d3198dc5c86396f5ea595fcc572496af 100644 +index e615c8b5c1142f547af77dafb33a8772ab5e13c3..f83c60f94d6eeec50aefa59a39f6230953fe5b7e 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -617,10 +617,11 @@ public final class ItemStack { diff --git a/patches/server/0811-Add-support-for-Proxy-Protocol.patch b/patches/server/0811-Add-support-for-Proxy-Protocol.patch index b7340ae196..99cf00a610 100644 --- a/patches/server/0811-Add-support-for-Proxy-Protocol.patch +++ b/patches/server/0811-Add-support-for-Proxy-Protocol.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add support for Proxy Protocol diff --git a/build.gradle.kts b/build.gradle.kts -index 98bed6bb990ecb40be0e2b74ad40f84ab0ba3705..f1ade7432ae6fae1bceb90f975448ab43543942f 100644 +index a46a627d9fb07fa43c95ca9eb48ba87302f66173..683159586641dd9aa42ae96fa51602469755723f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,6 +30,7 @@ dependencies { diff --git a/patches/server/0927-Optimize-Hoppers.patch b/patches/server/0927-Optimize-Hoppers.patch index 680623bb6b..f74f8f0f52 100644 --- a/patches/server/0927-Optimize-Hoppers.patch +++ b/patches/server/0927-Optimize-Hoppers.patch @@ -25,7 +25,7 @@ index b5ffa564cf6389b6af281ecf12b8daa139861608..0dbfe7e9c57e0ff52d30ccce3ae3a6af this.profiler.push(() -> { diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index fe153047d3198dc5c86396f5ea595fcc572496af..f9b9cb35a985108794588a1a0a9ca2556cc036b6 100644 +index f83c60f94d6eeec50aefa59a39f6230953fe5b7e..e0e80f94a005fb21cce76059f66cf4c7ee0f2bfc 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -728,10 +728,16 @@ public final class ItemStack { diff --git a/patches/server/0928-Fix-beehives-generating-from-using-bonemeal.patch b/patches/server/0928-Fix-beehives-generating-from-using-bonemeal.patch index bcfd448d92..47c1c7728e 100644 --- a/patches/server/0928-Fix-beehives-generating-from-using-bonemeal.patch +++ b/patches/server/0928-Fix-beehives-generating-from-using-bonemeal.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix beehives generating from using bonemeal diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index f9b9cb35a985108794588a1a0a9ca2556cc036b6..08464c7f114a04169c9ddeceef936749952770e6 100644 +index e0e80f94a005fb21cce76059f66cf4c7ee0f2bfc..c73b57ffd622ccc2e6c570cf874ed118108b899b 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -401,6 +401,7 @@ public final class ItemStack { diff --git a/patches/server/0947-Fix-block-place-logic.patch b/patches/server/0947-Fix-block-place-logic.patch index 6dbde32780..d08e5291bc 100644 --- a/patches/server/0947-Fix-block-place-logic.patch +++ b/patches/server/0947-Fix-block-place-logic.patch @@ -22,7 +22,7 @@ index b0204af850ee182773ad458208cccd946ad148d5..ebee8de2ed831755b6fd154f6cc77ac9 if ((entityhuman == null || !entityhuman.getAbilities().instabuild) && itemstack != ItemStack.EMPTY) { // CraftBukkit itemstack.shrink(1); diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 08464c7f114a04169c9ddeceef936749952770e6..62fc1b110ec319bb91aa0639b18aa354a306a9ca 100644 +index c73b57ffd622ccc2e6c570cf874ed118108b899b..efa73faab21c301a99cfe58c3d822d961ea4d2a5 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -472,13 +472,7 @@ public final class ItemStack { diff --git a/patches/server/0948-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch b/patches/server/0948-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch index 5508e21a8c..da9489efd3 100644 --- a/patches/server/0948-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch +++ b/patches/server/0948-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix spigot sound playing for BlockItem ItemStacks diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 62fc1b110ec319bb91aa0639b18aa354a306a9ca..fcd53d9c7a0a71624e68eb47e947fa783df4829f 100644 +index efa73faab21c301a99cfe58c3d822d961ea4d2a5..6e2c62336537fba187fbbb47c1f52f935683c0d5 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -523,7 +523,11 @@ public final class ItemStack { diff --git a/patches/server/0958-Add-event-for-player-editing-sign.patch b/patches/server/0958-Add-event-for-player-editing-sign.patch index c0a6bfc43c..d4ab94dc9f 100644 --- a/patches/server/0958-Add-event-for-player-editing-sign.patch +++ b/patches/server/0958-Add-event-for-player-editing-sign.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add event for player editing sign diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index fcd53d9c7a0a71624e68eb47e947fa783df4829f..7bb47643e748f57a51c613d0a2ee8d05e1fe1798 100644 +index 6e2c62336537fba187fbbb47c1f52f935683c0d5..21b3be35da5636fa726f36f569142de5d16ac1f3 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -502,7 +502,7 @@ public final class ItemStack { diff --git a/patches/server/0982-Only-capture-actual-tree-growth.patch b/patches/server/0982-Only-capture-actual-tree-growth.patch index 2880ab70b9..8686b1f9de 100644 --- a/patches/server/0982-Only-capture-actual-tree-growth.patch +++ b/patches/server/0982-Only-capture-actual-tree-growth.patch @@ -17,7 +17,7 @@ index e9b748a81ec223a701b56d2dc890c9eb223d8474..a0c7c6208314d981e8577ad69ef1c519 } } diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 7bb47643e748f57a51c613d0a2ee8d05e1fe1798..16f087adbf94b8fd6726ffd300b103dd709ad406 100644 +index 21b3be35da5636fa726f36f569142de5d16ac1f3..4697df75fdee2023c41260bed211e3e3d90d2b9b 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -401,6 +401,7 @@ public final class ItemStack { diff --git a/patches/server/0995-Properly-handle-BlockBreakEvent-isDropItems.patch b/patches/server/0995-Properly-handle-BlockBreakEvent-isDropItems.patch index befc573af4..be4fc3d3c2 100644 --- a/patches/server/0995-Properly-handle-BlockBreakEvent-isDropItems.patch +++ b/patches/server/0995-Properly-handle-BlockBreakEvent-isDropItems.patch @@ -108,10 +108,10 @@ index 845fa7e13e4a3416b504d0a4c5d5e0454d96b8ed..07157822659288e76b2fba34db8d5d56 diff --git a/src/test/java/io/papermc/paper/world/block/BlockPlayerDestroyOverrideTest.java b/src/test/java/io/papermc/paper/world/block/BlockPlayerDestroyOverrideTest.java new file mode 100644 -index 0000000000000000000000000000000000000000..b39b12cb6ff3caee5946b1c1b7c510f388d28d19 +index 0000000000000000000000000000000000000000..7c435f7079b429873f33d7bade82eca0c6b45842 --- /dev/null +++ b/src/test/java/io/papermc/paper/world/block/BlockPlayerDestroyOverrideTest.java -@@ -0,0 +1,48 @@ +@@ -0,0 +1,47 @@ +package io.papermc.paper.world.block; + +import io.github.classgraph.ClassGraph; @@ -131,7 +131,6 @@ index 0000000000000000000000000000000000000000..b39b12cb6ff3caee5946b1c1b7c510f3 + +public class BlockPlayerDestroyOverrideTest extends AbstractTestingBase { + -+ @MethodSource("parameters") + public static Stream<ClassInfo> parameters() { + final List<ClassInfo> classInfo = new ArrayList<>(); + try (ScanResult scanResult = new ClassGraph() @@ -157,6 +156,6 @@ index 0000000000000000000000000000000000000000..b39b12cb6ff3caee5946b1c1b7c510f3 + assertEquals(1, playerDestroy.size(), overridesPlayerDestroy.getName() + " has multiple playerDestroy methods"); + final MethodInfo next = playerDestroy.iterator().next(); + final MethodParameterInfo[] parameterInfo = next.getParameterInfo(); -+ assertEquals(overridesPlayerDestroy.getName() + " needs to change its override of playerDestroy", "boolean", parameterInfo[parameterInfo.length - 1].getTypeDescriptor().toStringWithSimpleNames()); ++ assertEquals("boolean", parameterInfo[parameterInfo.length - 1].getTypeDescriptor().toStringWithSimpleNames(), overridesPlayerDestroy.getName() + " needs to change its override of playerDestroy"); + } +} diff --git a/patches/server/1019-Fix-silent-equipment-change-for-mobs.patch b/patches/server/1019-Fix-silent-equipment-change-for-mobs.patch index e412f4baa9..ffcc2b8e38 100644 --- a/patches/server/1019-Fix-silent-equipment-change-for-mobs.patch +++ b/patches/server/1019-Fix-silent-equipment-change-for-mobs.patch @@ -64,10 +64,10 @@ index 87cae8ed22a2428a1dda8f2a4510e45fbc31eab5..ea8a0961190e9aafda4fed6fecd85097 } diff --git a/src/test/java/io/papermc/paper/entity/EntitySetItemSlotSilentOverrideTest.java b/src/test/java/io/papermc/paper/entity/EntitySetItemSlotSilentOverrideTest.java new file mode 100644 -index 0000000000000000000000000000000000000000..7b40accf09e4accc80e7e4367035765212c70056 +index 0000000000000000000000000000000000000000..81947843d1f2f7dc6f59d7b52f327d60b17d0dcc --- /dev/null +++ b/src/test/java/io/papermc/paper/entity/EntitySetItemSlotSilentOverrideTest.java -@@ -0,0 +1,52 @@ +@@ -0,0 +1,51 @@ +package io.papermc.paper.entity; + +import io.github.classgraph.ClassGraph; @@ -87,7 +87,6 @@ index 0000000000000000000000000000000000000000..7b40accf09e4accc80e7e43670357652 + +public class EntitySetItemSlotSilentOverrideTest extends AbstractTestingBase { + -+ @MethodSource("parameters") + public static Stream<ClassInfo> parameters() { + final List<ClassInfo> classInfo = new ArrayList<>(); + try (ScanResult scanResult = new ClassGraph() |