Fix tests

This commit is contained in:
Nassim Jahnke 2022-06-08 17:31:27 +02:00
parent 7a165c9c5d
commit 02804a49a2
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
7 changed files with 44 additions and 42 deletions

View File

@ -27,10 +27,10 @@ index e431e3435737e28394d81b56568a08b3c3148b9b..b23bde3b5e881f146539a307d0a59f21
+/.factorypath +/.factorypath
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..53fbbb989a8bec663f12e90c2890740220ac8cd4 index 0000000000000000000000000000000000000000..b81a893bd5418779544872eb4006adc6b3017a43
--- /dev/null --- /dev/null
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -0,0 +1,79 @@ @@ -0,0 +1,80 @@
+plugins { +plugins {
+ `java-library` + `java-library`
+ `maven-publish` + `maven-publish`
@ -56,6 +56,7 @@ index 0000000000000000000000000000000000000000..53fbbb989a8bec663f12e90c28907402
+ compileOnly(annotations) + compileOnly(annotations)
+ testCompileOnly(annotations) + testCompileOnly(annotations)
+ +
+ testImplementation("org.apache.commons:commons-lang3:3.12.0")
+ testImplementation("junit:junit:4.13.2") + testImplementation("junit:junit:4.13.2")
+ testImplementation("org.hamcrest:hamcrest-library:1.3") + testImplementation("org.hamcrest:hamcrest-library:1.3")
+ testImplementation("org.ow2.asm:asm-tree:9.3") + testImplementation("org.ow2.asm:asm-tree:9.3")

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Build system changes
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 53fbbb989a8bec663f12e90c2890740220ac8cd4..b929458b72f26568b4c87571113eb2f867359312 100644 index b81a893bd5418779544872eb4006adc6b3017a43..044b7c49b569e1170108c912e9307f7fec278762 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -14,15 +14,27 @@ dependencies { @@ -14,15 +14,27 @@ dependencies {
@ -34,10 +34,10 @@ index 53fbbb989a8bec663f12e90c2890740220ac8cd4..b929458b72f26568b4c87571113eb2f8
+ testCompileOnly(checkerQual) + testCompileOnly(checkerQual)
+ // Paper end + // Paper end
+ +
testImplementation("org.apache.commons:commons-lang3:3.12.0")
testImplementation("junit:junit:4.13.2") testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest-library:1.3") testImplementation("org.hamcrest:hamcrest-library:1.3")
testImplementation("org.ow2.asm:asm-tree:9.3") @@ -63,7 +75,7 @@ tasks.withType<Javadoc> {
@@ -62,7 +74,7 @@ tasks.withType<Javadoc> {
options.links( options.links(
"https://guava.dev/releases/31.0.1-jre/api/docs/", "https://guava.dev/releases/31.0.1-jre/api/docs/",
"https://javadoc.io/doc/org.yaml/snakeyaml/1.30/", "https://javadoc.io/doc/org.yaml/snakeyaml/1.30/",

View File

@ -7,7 +7,7 @@ Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 31cd1ba937c364447e32220ffef1d9ef95b634c6..da855f2208b50f024bb7577167a6da53c06a9a4a 100644 index f0423df165bf7d0f3fad21d26b64f31ba3e6aeee..6f31679c2944fae3b37847c683abb0d2e5791449 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -8,17 +8,36 @@ java { @@ -8,17 +8,36 @@ java {
@ -48,7 +48,7 @@ index 31cd1ba937c364447e32220ffef1d9ef95b634c6..da855f2208b50f024bb7577167a6da53
// Paper end // Paper end
compileOnly("org.apache.maven:maven-resolver-provider:3.8.5") compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")
@@ -76,9 +95,24 @@ tasks.withType<Javadoc> { @@ -77,9 +96,24 @@ tasks.withType<Javadoc> {
"https://guava.dev/releases/31.0.1-jre/api/docs/", "https://guava.dev/releases/31.0.1-jre/api/docs/",
"https://javadoc.io/doc/org.yaml/snakeyaml/1.30/", "https://javadoc.io/doc/org.yaml/snakeyaml/1.30/",
"https://javadoc.io/doc/org.jetbrains/annotations/23.0.0/", // Paper - we don't want Java 5 annotations "https://javadoc.io/doc/org.jetbrains/annotations/23.0.0/", // Paper - we don't want Java 5 annotations

View File

@ -113,7 +113,7 @@ index 0000000000000000000000000000000000000000..a02a02aa0c87e0f0ed9e509e4dcab015
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..f5ae132cef01666bacda11422c0b73dd585fea27 index 0000000000000000000000000000000000000000..c2861d5097e47611d0acd8c38696c9f225720942
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java +++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java
@@ -0,0 +1,655 @@ @@ -0,0 +1,655 @@
@ -176,7 +176,7 @@ index 0000000000000000000000000000000000000000..f5ae132cef01666bacda11422c0b73dd
+ */ + */
+ public static final MaterialSetTag BUCKETS = new MaterialSetTag(keyFor("buckets")) + public static final MaterialSetTag BUCKETS = new MaterialSetTag(keyFor("buckets"))
+ .endsWith("BUCKET") + .endsWith("BUCKET")
+ .ensureSize("BUCKETS", 10).lock(); + .ensureSize("BUCKETS", 11).lock();
+ +
+ /** + /**
+ * Covers coal and charcoal. + * Covers coal and charcoal.
@ -222,7 +222,7 @@ index 0000000000000000000000000000000000000000..f5ae132cef01666bacda11422c0b73dd
+ */ + */
+ public static final MaterialSetTag DOORS = new MaterialSetTag(keyFor("doors")) + public static final MaterialSetTag DOORS = new MaterialSetTag(keyFor("doors"))
+ .endsWith("_DOOR") + .endsWith("_DOOR")
+ .ensureSize("DOORS", 9).lock(); + .ensureSize("DOORS", 10).lock();
+ +
+ /** + /**
+ * Covers all dyes. + * Covers all dyes.
@ -236,14 +236,14 @@ index 0000000000000000000000000000000000000000..f5ae132cef01666bacda11422c0b73dd
+ */ + */
+ public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates")) + public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates"))
+ .endsWith("_GATE") + .endsWith("_GATE")
+ .ensureSize("FENCE_GATES", 8).lock(); + .ensureSize("FENCE_GATES", 9).lock();
+ +
+ /** + /**
+ * Covers all variants of fences. + * Covers all variants of fences.
+ */ + */
+ public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences")) + public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences"))
+ .endsWith("_FENCE") + .endsWith("_FENCE")
+ .ensureSize("FENCES", 9).lock(); + .ensureSize("FENCES", 10).lock();
+ +
+ /** + /**
+ * Covers all variants of fish buckets. + * Covers all variants of fish buckets.
@ -357,7 +357,7 @@ index 0000000000000000000000000000000000000000..f5ae132cef01666bacda11422c0b73dd
+ */ + */
+ public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates")) + public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates"))
+ .endsWith("_PRESSURE_PLATE") + .endsWith("_PRESSURE_PLATE")
+ .ensureSize("PRESSURE_PLATES", 12).lock(); + .ensureSize("PRESSURE_PLATES", 13).lock();
+ +
+ /** + /**
+ * Covers the variants of prismarine blocks. + * Covers the variants of prismarine blocks.
@ -436,7 +436,7 @@ index 0000000000000000000000000000000000000000..f5ae132cef01666bacda11422c0b73dd
+ */ + */
+ public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs")) + public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs"))
+ .endsWith("_SPAWN_EGG") + .endsWith("_SPAWN_EGG")
+ .ensureSize("SPAWN_EGGS", 67).lock(); + .ensureSize("SPAWN_EGGS", 71).lock();
+ +
+ /** + /**
+ * Covers all colors of stained glass. + * Covers all colors of stained glass.
@ -457,7 +457,7 @@ index 0000000000000000000000000000000000000000..f5ae132cef01666bacda11422c0b73dd
+ */ + */
+ public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors")) + public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors"))
+ .endsWith("_TRAPDOOR") + .endsWith("_TRAPDOOR")
+ .ensureSize("TRAPDOORS", 9).lock(); + .ensureSize("TRAPDOORS", 10).lock();
+ +
+ /** + /**
+ * Covers all wood variants of doors. + * Covers all wood variants of doors.
@ -465,7 +465,7 @@ index 0000000000000000000000000000000000000000..f5ae132cef01666bacda11422c0b73dd
+ public static final MaterialSetTag WOODEN_DOORS = new MaterialSetTag(keyFor("wooden_doors")) + public static final MaterialSetTag WOODEN_DOORS = new MaterialSetTag(keyFor("wooden_doors"))
+ .endsWith("_DOOR") + .endsWith("_DOOR")
+ .not(Material.IRON_DOOR) + .not(Material.IRON_DOOR)
+ .ensureSize("WOODEN_DOORS", 8).lock(); + .ensureSize("WOODEN_DOORS", 9).lock();
+ +
+ /** + /**
+ * Covers all wood variants of fences. + * Covers all wood variants of fences.
@ -473,7 +473,7 @@ index 0000000000000000000000000000000000000000..f5ae132cef01666bacda11422c0b73dd
+ public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences")) + public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences"))
+ .endsWith("_FENCE") + .endsWith("_FENCE")
+ .not(Material.NETHER_BRICK_FENCE) + .not(Material.NETHER_BRICK_FENCE)
+ .ensureSize("WOODEN_FENCES", 8).lock(); + .ensureSize("WOODEN_FENCES", 9).lock();
+ +
+ /** + /**
+ * Covers all wood variants of trapdoors. + * Covers all wood variants of trapdoors.
@ -481,14 +481,14 @@ index 0000000000000000000000000000000000000000..f5ae132cef01666bacda11422c0b73dd
+ public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors")) + public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors"))
+ .endsWith("_TRAPDOOR") + .endsWith("_TRAPDOOR")
+ .not(Material.IRON_TRAPDOOR) + .not(Material.IRON_TRAPDOOR)
+ .ensureSize("WOODEN_TRAPDOORS", 8).lock(); + .ensureSize("WOODEN_TRAPDOORS", 9).lock();
+ +
+ /** + /**
+ * Covers the wood variants of gates. + * Covers the wood variants of gates.
+ */ + */
+ public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates")) + public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates"))
+ .endsWith("_GATE") + .endsWith("_GATE")
+ .ensureSize("WOODEN_GATES", 8).lock(); + .ensureSize("WOODEN_GATES", 9).lock();
+ +
+ /** + /**
+ * Covers the variants of purpur. + * Covers the variants of purpur.
@ -502,7 +502,7 @@ index 0000000000000000000000000000000000000000..f5ae132cef01666bacda11422c0b73dd
+ */ + */
+ public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs")) + public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs"))
+ .endsWith("_SIGN") + .endsWith("_SIGN")
+ .ensureSize("SIGNS", 16).lock(); + .ensureSize("SIGNS", 18).lock();
+ +
+ /** + /**
+ * Covers the variants of a regular torch. + * Covers the variants of a regular torch.
@ -646,7 +646,7 @@ index 0000000000000000000000000000000000000000..f5ae132cef01666bacda11422c0b73dd
+ @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked")
+ public static final MaterialSetTag COLORABLE = new MaterialSetTag(keyFor("colorable")) + public static final MaterialSetTag COLORABLE = new MaterialSetTag(keyFor("colorable"))
+ .add(Tag.WOOL, Tag.CARPETS).add(SHULKER_BOXES, STAINED_GLASS, STAINED_GLASS_PANES, CONCRETES, BEDS).lock(); + .add(Tag.WOOL, Tag.CARPETS).add(SHULKER_BOXES, STAINED_GLASS, STAINED_GLASS_PANES, CONCRETES, BEDS).lock();
+ //.ensureSize("COLORABLE", 81).lock(); unit test don't have the vanilla item tags, so counts don't line up for real + //.ensureSize("COLORABLE", 81).lock(); unit test don't have the vanilla item tags, so counts don't line up for real
+ +
+ /** + /**
+ * Covers the variants of coral. + * Covers the variants of coral.
@ -674,28 +674,28 @@ index 0000000000000000000000000000000000000000..f5ae132cef01666bacda11422c0b73dd
+ * Covers all items that can be enchanted from the enchantment table or anvil. + * Covers all items that can be enchanted from the enchantment table or anvil.
+ */ + */
+ public static final MaterialSetTag ENCHANTABLE = new MaterialSetTag(keyFor("enchantable")) + public static final MaterialSetTag ENCHANTABLE = new MaterialSetTag(keyFor("enchantable"))
+ .add(PICKAXES, SWORDS, SHOVELS, AXES, HOES, HELMETS, CHEST_EQUIPPABLE, LEGGINGS, BOOTS, BOWS) + .add(PICKAXES, SWORDS, SHOVELS, AXES, HOES, HELMETS, CHEST_EQUIPPABLE, LEGGINGS, BOOTS, BOWS)
+ .add(Material.TRIDENT, Material.SHIELD, Material.FISHING_ROD, Material.SHEARS, Material.FLINT_AND_STEEL, Material.CARROT_ON_A_STICK, Material.WARPED_FUNGUS_ON_A_STICK) + .add(Material.TRIDENT, Material.SHIELD, Material.FISHING_ROD, Material.SHEARS, Material.FLINT_AND_STEEL, Material.CARROT_ON_A_STICK, Material.WARPED_FUNGUS_ON_A_STICK)
+ .ensureSize("ENCHANTABLE", 65).lock(); + .ensureSize("ENCHANTABLE", 65).lock();
+ +
+ /** + /**
+ * Covers the variants of raw ores. + * Covers the variants of raw ores.
+ */ + */
+ public static final MaterialSetTag RAW_ORES = new MaterialSetTag(keyFor("raw_ores")) + public static final MaterialSetTag RAW_ORES = new MaterialSetTag(keyFor("raw_ores"))
+ .add(Material.RAW_COPPER, Material.RAW_GOLD, Material.RAW_IRON).lock(); + .add(Material.RAW_COPPER, Material.RAW_GOLD, Material.RAW_IRON).lock();
+ +
+ /** + /**
+ * Covers the variants of deepslate ores. + * Covers the variants of deepslate ores.
+ */ + */
+ public static final MaterialSetTag DEEPSLATE_ORES = new MaterialSetTag(keyFor("deepslate_ores")) + public static final MaterialSetTag DEEPSLATE_ORES = new MaterialSetTag(keyFor("deepslate_ores"))
+ .add(material -> material.name().startsWith("DEEPSLATE_") && material.name().endsWith("_ORE")) + .add(material -> material.name().startsWith("DEEPSLATE_") && material.name().endsWith("_ORE"))
+ .ensureSize("DEEPSLATE_ORES", 8).lock(); + .ensureSize("DEEPSLATE_ORES", 8).lock();
+ +
+ /** + /**
+ * Covers the variants of raw ore blocks. + * Covers the variants of raw ore blocks.
+ */ + */
+ public static final MaterialSetTag RAW_ORE_BLOCKS = new MaterialSetTag(keyFor("raw_ore_blocks")) + public static final MaterialSetTag RAW_ORE_BLOCKS = new MaterialSetTag(keyFor("raw_ore_blocks"))
+ .add(Material.RAW_COPPER_BLOCK, Material.RAW_GOLD_BLOCK, Material.RAW_IRON_BLOCK).lock(); + .add(Material.RAW_COPPER_BLOCK, Material.RAW_GOLD_BLOCK, Material.RAW_IRON_BLOCK).lock();
+ +
+ /** + /**
+ * Covers all oxidized copper blocks. + * Covers all oxidized copper blocks.

View File

@ -97,7 +97,7 @@ index b4d5817998d8aa0c6e6eb3c01af0bc1d804e794b..108561244fa1062cd98be76fdff471fd
if (getMainArm() != packet.mainHand()) { if (getMainArm() != packet.mainHand()) {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT); PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 9bce12ed1842934fb05233337d2571ad44f7fe07..9747023b0102c055e56b5a8434d3e003d1ed1059 100644 index b627746a04994dc5b6ddb7508ac9442a04aa2d5f..ccdbeadcb232832b12c3249a24966136b7ac54fd 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -574,6 +574,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -574,6 +574,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -127,14 +127,13 @@ index 9bce12ed1842934fb05233337d2571ad44f7fe07..9747023b0102c055e56b5a8434d3e003
@Override @Override
diff --git a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java 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 new file mode 100644
index 0000000000000000000000000000000000000000..6cd015dc5a2e012ac827c2b2d9aa5542b0591afb index 0000000000000000000000000000000000000000..fab3063fffa959ac7f0eb5937f2fae94d11b6591
--- /dev/null --- /dev/null
+++ b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java +++ b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
@@ -0,0 +1,19 @@ @@ -0,0 +1,18 @@
+package io.papermc.paper.world; +package io.papermc.paper.world;
+ +
+import com.destroystokyo.paper.ClientOption; +import com.destroystokyo.paper.ClientOption;
+import net.minecraft.network.chat.TranslatableComponent;
+import net.minecraft.world.entity.player.ChatVisiblity; +import net.minecraft.world.entity.player.ChatVisiblity;
+import org.bukkit.Difficulty; +import org.bukkit.Difficulty;
+import org.junit.Assert; +import org.junit.Assert;

View File

@ -77,12 +77,14 @@ index bc6d9dc549b865d47899db947b7e5b00ff312d2f..25813d45ba3b39fa1e1d566ca04ed122
/** /**
diff --git a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java diff --git a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
index 6cd015dc5a2e012ac827c2b2d9aa5542b0591afb..3a569514f051d9941cb9c2d7ed3d59633f7b8493 100644 index fab3063fffa959ac7f0eb5937f2fae94d11b6591..94dacabea836bc27eb678bd4465d8b9a01d98d91 100644
--- a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java --- a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
+++ b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java +++ b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
@@ -3,11 +3,22 @@ package io.papermc.paper.world; @@ -1,12 +1,24 @@
package io.papermc.paper.world;
import com.destroystokyo.paper.ClientOption; import com.destroystokyo.paper.ClientOption;
import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.contents.TranslatableContents;
import net.minecraft.world.entity.player.ChatVisiblity; import net.minecraft.world.entity.player.ChatVisiblity;
+import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.CreativeModeTab;
+import net.minecraft.world.level.GameType; +import net.minecraft.world.level.GameType;
@ -104,7 +106,7 @@ index 6cd015dc5a2e012ac827c2b2d9aa5542b0591afb..3a569514f051d9941cb9c2d7ed3d5963
@Test @Test
public void testChatVisibilityKeys() { public void testChatVisibilityKeys() {
@@ -16,4 +27,52 @@ public class TranslationKeyTest { @@ -15,4 +27,52 @@ public class TranslationKeyTest {
Assert.assertEquals(chatVisibility + "'s translation key doesn't match", ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey()); Assert.assertEquals(chatVisibility + "'s translation key doesn't match", ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey());
} }
} }
@ -112,7 +114,7 @@ index 6cd015dc5a2e012ac827c2b2d9aa5542b0591afb..3a569514f051d9941cb9c2d7ed3d5963
+ @Test + @Test
+ public void testDifficultyKeys() { + public void testDifficultyKeys() {
+ for (Difficulty bukkitDifficulty : Difficulty.values()) { + for (Difficulty bukkitDifficulty : Difficulty.values()) {
+ Assert.assertEquals(bukkitDifficulty + "'s translation key doesn't match", ((TranslatableComponent) net.minecraft.world.Difficulty.byId(bukkitDifficulty.ordinal()).getDisplayName()).getKey(), bukkitDifficulty.translationKey()); + Assert.assertEquals(bukkitDifficulty + "'s translation key doesn't match", ((TranslatableContents) net.minecraft.world.Difficulty.byId(bukkitDifficulty.ordinal()).getDisplayName().getContents()).getKey(), bukkitDifficulty.translationKey());
+ } + }
+ } + }
+ +
@ -144,7 +146,7 @@ index 6cd015dc5a2e012ac827c2b2d9aa5542b0591afb..3a569514f051d9941cb9c2d7ed3d5963
+ continue; + continue;
+ } + }
+ CreativeCategory category = Objects.requireNonNull(CraftCreativeCategory.fromNMS(tab)); + CreativeCategory category = Objects.requireNonNull(CraftCreativeCategory.fromNMS(tab));
+ Assert.assertEquals("translation key mismatch for " + category, ((TranslatableComponent) tab.getDisplayName()).getKey(), category.translationKey()); + Assert.assertEquals("translation key mismatch for " + category, ((TranslatableContents) tab.getDisplayName().getContents()).getKey(), category.translationKey());
+ } + }
+ } + }
+ +
@ -153,7 +155,7 @@ index 6cd015dc5a2e012ac827c2b2d9aa5542b0591afb..3a569514f051d9941cb9c2d7ed3d5963
+ for (GameType nms : GameType.values()) { + for (GameType nms : GameType.values()) {
+ GameMode bukkit = GameMode.getByValue(nms.getId()); + GameMode bukkit = GameMode.getByValue(nms.getId());
+ Assert.assertNotNull(bukkit); + Assert.assertNotNull(bukkit);
+ Assert.assertEquals("translation key mismatch for " + bukkit, ((TranslatableComponent) nms.getLongDisplayName()).getKey(), bukkit.translationKey()); + Assert.assertEquals("translation key mismatch for " + bukkit, ((TranslatableContents) nms.getLongDisplayName().getContents()).getKey(), bukkit.translationKey());
+ } + }
+ } + }
} }

View File

@ -129,7 +129,7 @@ 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 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 new file mode 100644
index 0000000000000000000000000000000000000000..520801e294a33ae62d9aa24dc0247591e379311d index 0000000000000000000000000000000000000000..4d043e0e43ef8bb75788e195f95b5a50a51a2a48
--- /dev/null --- /dev/null
+++ b/src/test/java/io/papermc/paper/advancement/AdvancementFrameTest.java +++ b/src/test/java/io/papermc/paper/advancement/AdvancementFrameTest.java
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
@ -138,7 +138,7 @@ index 0000000000000000000000000000000000000000..520801e294a33ae62d9aa24dc0247591
+import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.adventure.PaperAdventure;
+import net.kyori.adventure.text.format.TextColor; +import net.kyori.adventure.text.format.TextColor;
+import net.minecraft.advancements.FrameType; +import net.minecraft.advancements.FrameType;
+import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.contents.TranslatableContents;
+import org.junit.Test; +import org.junit.Test;
+ +
+import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertEquals;
@ -149,7 +149,7 @@ index 0000000000000000000000000000000000000000..520801e294a33ae62d9aa24dc0247591
+ public void test() { + public void test() {
+ for (FrameType nmsFrameType : FrameType.values()) { + for (FrameType nmsFrameType : FrameType.values()) {
+ final TextColor expectedColor = PaperAdventure.asAdventure(nmsFrameType.getChatColor()); + final TextColor expectedColor = PaperAdventure.asAdventure(nmsFrameType.getChatColor());
+ final String expectedTranslationKey = ((TranslatableComponent) nmsFrameType.getDisplayName()).getKey(); + final String expectedTranslationKey = ((TranslatableContents) nmsFrameType.getDisplayName().getContents()).getKey();
+ final var frame = PaperAdvancementDisplay.asPaperFrame(nmsFrameType); + final var frame = PaperAdvancementDisplay.asPaperFrame(nmsFrameType);
+ assertEquals("The translation keys should be the same", expectedTranslationKey, frame.translationKey()); + assertEquals("The translation keys should be the same", expectedTranslationKey, frame.translationKey());
+ assertEquals("The frame colors should be the same", expectedColor, frame.color()); + assertEquals("The frame colors should be the same", expectedColor, frame.color());