aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2022-10-11 20:05:28 -0700
committerGitHub <[email protected]>2022-10-11 20:05:28 -0700
commitb9cf1ac5804aa84f9d6b0bdc08ab643367bd22f9 (patch)
treeceb5f7c0e606df6451da606560b92ca821a06677
parentf7c8d7966775dcba3e80580039afa54790867daf (diff)
downloadPaper-b9cf1ac5804aa84f9d6b0bdc08ab643367bd22f9.tar.gz
Paper-b9cf1ac5804aa84f9d6b0bdc08ab643367bd22f9.zip
Fix a classloading issue in tests (#8459)
-rw-r--r--patches/server/0009-Adventure.patch4
-rw-r--r--patches/server/0696-Add-advancement-display-API.patch11
2 files changed, 4 insertions, 11 deletions
diff --git a/patches/server/0009-Adventure.patch b/patches/server/0009-Adventure.patch
index a0d43a7b04..91adb54873 100644
--- a/patches/server/0009-Adventure.patch
+++ b/patches/server/0009-Adventure.patch
@@ -694,7 +694,7 @@ index 0000000000000000000000000000000000000000..2fd6c3e65354071af71c7d8ebb97b559
+}
diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
new file mode 100644
-index 0000000000000000000000000000000000000000..6679038054796b9bdfeb6fb4b29e50aa63052101
+index 0000000000000000000000000000000000000000..dbfb8746355be22e11d05cac33d18e04b94aa985
--- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
@@ -0,0 +1,331 @@
@@ -741,7 +741,6 @@ index 0000000000000000000000000000000000000000..6679038054796b9bdfeb6fb4b29e50aa
+import org.jetbrains.annotations.Nullable;
+
+public final class PaperAdventure {
-+ public static final AttributeKey<Locale> LOCALE_ATTRIBUTE = AttributeKey.valueOf("adventure:locale");
+ private static final Pattern LOCALIZATION_PATTERN = Pattern.compile("%(?:(\\d+)\\$)?s");
+ public static final ComponentFlattener FLATTENER = ComponentFlattener.basic().toBuilder()
+ .complexMapper(TranslatableComponent.class, (translatable, consumer) -> {
@@ -791,6 +790,7 @@ index 0000000000000000000000000000000000000000..6679038054796b9bdfeb6fb4b29e50aa
+ }
+ })
+ .build();
++ public static final AttributeKey<Locale> LOCALE_ATTRIBUTE = AttributeKey.valueOf("adventure:locale"); // init after FLATTENER because classloading triggered here might create a logger
+ @Deprecated public static final PlainComponentSerializer PLAIN = PlainComponentSerializer.builder().flattener(FLATTENER).build();
+ private static final Codec<CompoundTag, String, IOException, IOException> NBT_CODEC = new Codec<CompoundTag, String, IOException, IOException>() {
+ @Override
diff --git a/patches/server/0696-Add-advancement-display-API.patch b/patches/server/0696-Add-advancement-display-API.patch
index ffabea75c3..dd860e3b4d 100644
--- a/patches/server/0696-Add-advancement-display-API.patch
+++ b/patches/server/0696-Add-advancement-display-API.patch
@@ -129,28 +129,21 @@ index c47cae84f3b6970247d78382f48ae8ddbc202b59..0a46eeefa7d704350321828166f0049d
}
diff --git a/src/test/java/io/papermc/paper/advancement/AdvancementFrameTest.java b/src/test/java/io/papermc/paper/advancement/AdvancementFrameTest.java
new file mode 100644
-index 0000000000000000000000000000000000000000..8888e6026d65ac74d6e7471763dfa18807216c3e
+index 0000000000000000000000000000000000000000..4d043e0e43ef8bb75788e195f95b5a50a51a2a48
--- /dev/null
+++ b/src/test/java/io/papermc/paper/advancement/AdvancementFrameTest.java
-@@ -0,0 +1,31 @@
+@@ -0,0 +1,24 @@
+package io.papermc.paper.advancement;
+
-+import com.mojang.logging.LogUtils;
+import io.papermc.paper.adventure.PaperAdventure;
+import net.kyori.adventure.text.format.TextColor;
+import net.minecraft.advancements.FrameType;
+import net.minecraft.network.chat.contents.TranslatableContents;
-+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class AdvancementFrameTest {
-+ @Before
-+ public void before() {
-+ // Work around weird classloading issue when initializing PaperAdventure
-+ LogUtils.getLogger();
-+ }
+
+ @Test
+ public void test() {