Updated Upstream (Bukkit/CraftBukkit)

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:
fb23cbb3 Define surefire plugin version
d022084a Define ordering for MetadataStoreTest
99a7f6f0 PR-910: Match generic max absorption attribute name style with the rest
c7390d71 PR-909: Update tests to JUnit 5

CraftBukkit Changes:
f0661c351 PR-1230: Move unstructured PDC NBT serialisation to SNBT
452fcb599 PR-1256: Update tests to JUnit 5
This commit is contained in:
Nassim Jahnke 2023-09-24 17:16:58 +10:00
parent 7a00758b1b
commit e284bb1215
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
66 changed files with 397 additions and 400 deletions

View File

@ -27,7 +27,7 @@ index 11038da2e071699d6561a331565db0c8d7850d0e..317acfec5894101294a55abff6181943
+/.factorypath
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..441900671977b15a8edb8b9ffe07c8cb05faba54
index 0000000000000000000000000000000000000000..1e8a4a87f963a8cf0e61e3c06925b864b437f8f5
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,87 @@
@ -61,8 +61,8 @@ index 0000000000000000000000000000000000000000..441900671977b15a8edb8b9ffe07c8cb
+ testCompileOnly(annotations)
+
+ testImplementation("org.apache.commons:commons-lang3:3.12.0")
+ testImplementation("junit:junit:4.13.2")
+ testImplementation("org.hamcrest:hamcrest-library:1.3")
+ testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
+ testImplementation("org.hamcrest:hamcrest:2.2")
+ testImplementation("org.mockito:mockito-core:5.5.0")
+ testImplementation("org.ow2.asm:asm-tree:9.5")
+}
@ -120,10 +120,10 @@ index 0000000000000000000000000000000000000000..441900671977b15a8edb8b9ffe07c8cb
+}
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index c35ee75d4e9ef79be6d6c5eb3eb50a454e397849..0000000000000000000000000000000000000000
index e31246ebbe2af2950d63ad413460ea7c0c6baa36..0000000000000000000000000000000000000000
--- a/pom.xml
+++ /dev/null
@@ -1,276 +0,0 @@
@@ -1,281 +0,0 @@
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@ -219,15 +219,15 @@ index c35ee75d4e9ef79be6d6c5eb3eb50a454e397849..00000000000000000000000000000000
- </dependency>
- <!-- testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>5.10.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <version>1.3</version>
- <artifactId>hamcrest</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
@ -339,6 +339,11 @@ index c35ee75d4e9ef79be6d6c5eb3eb50a454e397849..00000000000000000000000000000000
- </tags>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>3.1.0</version>
- </plugin>
- </plugins>
- </build>
-

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Build system changes
diff --git a/build.gradle.kts b/build.gradle.kts
index 441900671977b15a8edb8b9ffe07c8cb05faba54..bb8dcc075bf69cda47ddd138ee36ab9ac59a2d50 100644
index 1e8a4a87f963a8cf0e61e3c06925b864b437f8f5..048dc1ffa90672a00f61da0271a550f9e877e8cd 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -18,15 +18,27 @@ dependencies {
@ -35,8 +35,8 @@ index 441900671977b15a8edb8b9ffe07c8cb05faba54..bb8dcc075bf69cda47ddd138ee36ab9a
+ // Paper end
+
testImplementation("org.apache.commons:commons-lang3:3.12.0")
testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest-library:1.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
testImplementation("org.hamcrest:hamcrest:2.2")
@@ -69,8 +81,12 @@ tasks.withType<Javadoc> {
options.links(
"https://guava.dev/releases/32.1.2-jre/api/docs/",

View File

@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..77154095cfb8b259bdb318e8ff40cb6f
+ }
+}
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
index 4ac3dd977e75cd8464163351d306e037ee32cb48..c26ea217927ba77611e6ae93f8df50a83bceb3dd 100644
index 64e7aef6220097edefdff3b98a771b988365930d..abadff47166722fdc756afdbc6ac7242b6bd4fb0 100644
--- a/src/test/java/org/bukkit/AnnotationTest.java
+++ b/src/test/java/org/bukkit/AnnotationTest.java
@@ -29,7 +29,13 @@ public class AnnotationTest {
@ -146,8 +146,8 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..c26ea217927ba77611e6ae93f8df50a8
+ builder.append("\t").append(message).append("\n");
}
- Assert.fail("There " + errors.size() + " are missing annotation(s)");
+ Assert.fail(builder.toString());
- fail("There " + errors.size() + " are missing annotation(s)");
+ fail(builder.toString());
}
private static void collectClasses(@NotNull File from, @NotNull Map<String, ClassNode> to) throws IOException {
@ -205,17 +205,17 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..c26ea217927ba77611e6ae93f8df50a8
return false;
}
diff --git a/src/test/java/org/bukkit/BukkitMirrorTest.java b/src/test/java/org/bukkit/BukkitMirrorTest.java
index 2dfada66067d79b84cd490eadbe0178e8cd8c260..06d66512c91c680130132b79e34fbf32245ff9ee 100644
index 89ca06ebecdaadd5dfc7bc74473ca15ad36f6eff..a07d35a6615e788361ac4c8b8954a2876d1306b2 100644
--- a/src/test/java/org/bukkit/BukkitMirrorTest.java
+++ b/src/test/java/org/bukkit/BukkitMirrorTest.java
@@ -20,6 +20,7 @@ public class BukkitMirrorTest {
@@ -12,6 +12,7 @@ import org.junit.jupiter.params.provider.MethodSource;
public class BukkitMirrorTest {
@Parameters(name = "{index}: {1}")
public static List<Object[]> data() {
+ if (true) return List.of(); // Paper
return Lists.transform(Arrays.asList(Server.class.getDeclaredMethods()), new Function<Method, Object[]>() {
@Override
public Object[] apply(Method input) {
public static Stream<Arguments> data() {
+ if (true) return Stream.of(); // Paper
return Stream.of(Server.class.getDeclaredMethods())
.map(method -> {
try {
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

View File

@ -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 bb8dcc075bf69cda47ddd138ee36ab9ac59a2d50..808817bad1a175e61eb80f3624ab86547ce30a6b 100644
index 048dc1ffa90672a00f61da0271a550f9e877e8cd..98d7bca03ee3805a1d32f3eb7dc520d88cb1787a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -22,6 +22,7 @@ dependencies {

View File

@ -7,7 +7,7 @@ Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/build.gradle.kts b/build.gradle.kts
index 808817bad1a175e61eb80f3624ab86547ce30a6b..9507e05242212f71637f5f2138e4ea8cf2f1d7f8 100644
index 98d7bca03ee3805a1d32f3eb7dc520d88cb1787a..b649f81d11c043649fa3e6e65ebd5dd70d2e9469 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -10,12 +10,24 @@ java {
@ -4982,7 +4982,7 @@ index 7b9a7890b25ca4bd95ab81f3181288bf79ed649c..e5a38e3568148170025e05c7ba69e861
/**
diff --git a/src/test/java/io/papermc/paper/adventure/KeyTest.java b/src/test/java/io/papermc/paper/adventure/KeyTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..70c575077d204e4b36d07559f6a8d952b84af1cf
index 0000000000000000000000000000000000000000..7ede17d60358e0e3a04f3166ea9657e5239e0d8f
--- /dev/null
+++ b/src/test/java/io/papermc/paper/adventure/KeyTest.java
@@ -0,0 +1,31 @@
@ -4992,10 +4992,10 @@ index 0000000000000000000000000000000000000000..70c575077d204e4b36d07559f6a8d952
+import java.util.Set;
+import net.kyori.adventure.key.Key;
+import org.bukkit.NamespacedKey;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class KeyTest {
+

View File

@ -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 9507e05242212f71637f5f2138e4ea8cf2f1d7f8..12e9f88b1cd8a6d7a333aebcb514cf6dced7af17 100644
index b649f81d11c043649fa3e6e65ebd5dd70d2e9469..df783fda358889a23e9219b364181c626ff3dfea 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -42,6 +42,9 @@ dependencies {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Paper Plugins
diff --git a/build.gradle.kts b/build.gradle.kts
index 12e9f88b1cd8a6d7a333aebcb514cf6dced7af17..edb6312978c58f45cb6b8db7ac475e26896d709f 100644
index df783fda358889a23e9219b364181c626ff3dfea..d3a55d64623b2421740da4eb6ebb08cca56a05e8 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -47,7 +47,7 @@ dependencies {
@ -2278,20 +2278,20 @@ index 2f74ec96ece706de23156ebabfe493211bc05391..302319acbc257a075adfb78d9f5c49fd
}
diff --git a/src/test/java/org/bukkit/event/SyntheticEventTest.java b/src/test/java/org/bukkit/event/SyntheticEventTest.java
deleted file mode 100644
index ab53cf14389454d2dd5e71494a90ea7b09963b8f..0000000000000000000000000000000000000000
index 40a086f2883c4419d2bf0bd44285f7c55562ba3e..0000000000000000000000000000000000000000
--- a/src/test/java/org/bukkit/event/SyntheticEventTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.bukkit.event;
-
-import static org.junit.jupiter.api.Assertions.*;
-import org.bukkit.Bukkit;
-import org.bukkit.plugin.PluginLoader;
-import org.bukkit.plugin.SimplePluginManager;
-import org.bukkit.plugin.TestPlugin;
-import org.bukkit.plugin.java.JavaPluginLoader;
-import org.bukkit.support.AbstractTestingBase;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.jupiter.api.Test;
-
-public class SyntheticEventTest extends AbstractTestingBase {
- @SuppressWarnings("deprecation")
@ -2312,7 +2312,7 @@ index ab53cf14389454d2dd5e71494a90ea7b09963b8f..00000000000000000000000000000000
- pluginManager.registerEvents(impl, plugin);
- pluginManager.callEvent(event);
-
- Assert.assertEquals(1, impl.callCount);
- assertEquals(1, impl.callCount);
- }
-
- public abstract static class Base<E extends Event> implements Listener {
@ -2333,21 +2333,21 @@ index ab53cf14389454d2dd5e71494a90ea7b09963b8f..00000000000000000000000000000000
-}
diff --git a/src/test/java/org/bukkit/plugin/PluginManagerTest.java b/src/test/java/org/bukkit/plugin/PluginManagerTest.java
deleted file mode 100644
index 4c61b180c2f67205351aac48ebb5e8e9db5ee6d3..0000000000000000000000000000000000000000
index 03b08e47e91e8b56c1992fcd749a62eb9e7d4d68..0000000000000000000000000000000000000000
--- a/src/test/java/org/bukkit/plugin/PluginManagerTest.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package org.bukkit.plugin;
-
-import static org.bukkit.support.MatcherAssert.*;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-import org.bukkit.Bukkit;
-import org.bukkit.event.Event;
-import org.bukkit.event.TestEvent;
-import org.bukkit.permissions.Permission;
-import org.bukkit.support.AbstractTestingBase;
-import org.junit.After;
-import org.junit.Test;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-public class PluginManagerTest extends AbstractTestingBase {
- private class MutableObject {
@ -2503,20 +2503,20 @@ index 4c61b180c2f67205351aac48ebb5e8e9db5ee6d3..00000000000000000000000000000000
- private void testRemovePermissionByName(final String name) {
- final Permission perm = new Permission(name);
- pm.addPermission(perm);
- assertThat("Permission \"" + name + "\" was not added", pm.getPermission(name), is(perm));
- assertThat(pm.getPermission(name), is(perm), "Permission \"" + name + "\" was not added");
- pm.removePermission(name);
- assertThat("Permission \"" + name + "\" was not removed", pm.getPermission(name), is(nullValue()));
- assertThat(pm.getPermission(name), is(nullValue()), "Permission \"" + name + "\" was not removed");
- }
-
- private void testRemovePermissionByPermission(final String name) {
- final Permission perm = new Permission(name);
- pm.addPermission(perm);
- assertThat("Permission \"" + name + "\" was not added", pm.getPermission(name), is(perm));
- assertThat(pm.getPermission(name), is(perm), "Permission \"" + name + "\" was not added");
- pm.removePermission(perm);
- assertThat("Permission \"" + name + "\" was not removed", pm.getPermission(name), is(nullValue()));
- assertThat(pm.getPermission(name), is(nullValue()), "Permission \"" + name + "\" was not removed");
- }
-
- @After
- @AfterEach
- public void tearDown() {
- pm.clearPlugins();
- assertThat(pm.getPermissions(), is(empty()));

View File

@ -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 edb6312978c58f45cb6b8db7ac475e26896d709f..0b9530ae4542c55c77294185a61d1d739d0eaac2 100644
index d3a55d64623b2421740da4eb6ebb08cca56a05e8..afe9e9b08499ac504f4198ffb8da34cd286a6b44 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -11,6 +11,8 @@ java {

View File

@ -578,7 +578,7 @@ index 270e6d8ad4358baa256cee5f16cff281f063ce3b..4a3451af454295ac3e1b688e6665cad9
@Override
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
index c26ea217927ba77611e6ae93f8df50a83bceb3dd..06e96e5c98f1a7a68c8b4b5e527314c1aa774e38 100644
index abadff47166722fdc756afdbc6ac7242b6bd4fb0..88f1ca89fa640a686231b8eec87e70419b2d73ef 100644
--- a/src/test/java/org/bukkit/AnnotationTest.java
+++ b/src/test/java/org/bukkit/AnnotationTest.java
@@ -48,6 +48,8 @@ public class AnnotationTest {

View File

@ -1134,10 +1134,10 @@ index 02f75db7ac55f792e84a08138e89657a3e226ff5..69462a0679c255acee2adb84f590523d
public interface Tag<T extends Keyed> extends Keyed {
diff --git a/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..c248493712a50b18cb860cea4be2add81ca35750
index 0000000000000000000000000000000000000000..82ee9a486d1c3deec6e529b1cb12ecc2c6a5862e
--- /dev/null
+++ b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java
@@ -0,0 +1,59 @@
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ */
@ -1146,17 +1146,16 @@ index 0000000000000000000000000000000000000000..c248493712a50b18cb860cea4be2add8
+
+import io.papermc.paper.tag.BaseTag;
+import io.papermc.paper.tag.EntityTags;
+import org.bukkit.Bukkit;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.Test;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import org.bukkit.Bukkit;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class MaterialTagsTest extends AbstractTestingBase {
+
@ -1179,7 +1178,7 @@ index 0000000000000000000000000000000000000000..c248493712a50b18cb860cea4be2add8
+
+ private static void testLocked(Class<?> clazz) {
+ for (BaseTag<?, ?> tag : collectTags(clazz)) {
+ assertTrue("Tag " + tag.key() + " is not locked", tag.isLocked());
+ assertTrue(tag.isLocked(), "Tag " + tag.key() + " is not locked");
+ }
+ }
+
@ -1199,7 +1198,7 @@ index 0000000000000000000000000000000000000000..c248493712a50b18cb860cea4be2add8
+}
diff --git a/src/test/java/io/papermc/paper/EntityTagsTest.java b/src/test/java/io/papermc/paper/EntityTagsTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..83ecee478f81696f523783974941a8c15ea02e16
index 0000000000000000000000000000000000000000..91d70cc703192b5a3a48211ee0dadd2e4260ec00
--- /dev/null
+++ b/src/test/java/io/papermc/paper/EntityTagsTest.java
@@ -0,0 +1,21 @@
@ -1209,7 +1208,7 @@ index 0000000000000000000000000000000000000000..83ecee478f81696f523783974941a8c1
+import java.util.logging.Level;
+import org.bukkit.Bukkit;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+public class EntityTagsTest extends AbstractTestingBase {
+

View File

@ -18,7 +18,7 @@ index 1d061412cdafa28c6940c7433747ab1dabe23de1..6fda7f3aa68e76af64362e9afed70fc6
@Override
diff --git a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java
index bf00b7a9d8fd50fbc79c2dcb3d5698975d685fe5..a6a1a9c451b1543715135de5eebbfb2746fb5464 100644
index 144ae2f31badb8142bc4a76a7abab37a57118191..8ffaa33d97c045c0fd6851ec2f189344b4a070d2 100644
--- a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java
+++ b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java
@@ -26,8 +26,8 @@ public class StandardMessengerTest {

View File

@ -1265,12 +1265,12 @@ index 0ea9c6b2420a0f990bd1fdf50fc015e37a7060d8..e99644eae1c662b117aa19060d2484ac
/**
diff --git a/src/test/java/org/bukkit/materials/MaterialDataTest.java b/src/test/java/org/bukkit/materials/MaterialDataTest.java
index a935ae4a25b7955416652bf8c4690a804f12e903..e83321263bb0e2b67af981dbb2e8fec4e973ae56 100644
index 8d78435cc42a9e668b2d4d674b79b4094c3bd1b1..24a8ce4387b897c717b55405f363ffafff45894d 100644
--- a/src/test/java/org/bukkit/materials/MaterialDataTest.java
+++ b/src/test/java/org/bukkit/materials/MaterialDataTest.java
@@ -22,6 +22,7 @@ import org.bukkit.material.WoodenStep;
import org.bukkit.material.types.MushroomBlockTexture;
import org.junit.Test;
import org.junit.jupiter.api.Test;
+@Deprecated // Paper
public class MaterialDataTest {

View File

@ -233,7 +233,7 @@ index e3faa2c675c85a9cbdbbb1debec0ff81c58a1bbd..fd1629c2d2028a88fb3d56b0aeb833d1
String getTranslationKey();
}
diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java
index fc15b9d4fbe31415e4e2a956419bc959da3395aa..bf4b6bc6edeb077d34f75b0e9a62cdecf8e7f86c 100644
index 36501052de5ad0b80aa1dcbe97d44dd3204f749b..37f93b7e9f722e76631c3e7d3e770526ee0c3926 100644
--- a/src/main/java/org/bukkit/attribute/Attribute.java
+++ b/src/main/java/org/bukkit/attribute/Attribute.java
@@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull;

View File

@ -209,11 +209,11 @@ index 879d637691683ca862045402f74b751a892bf3ff..63034a66bcc10db939c497552b73ba96
public enum Type { SOUND, VISUAL }
}
diff --git a/src/test/java/org/bukkit/EffectTest.java b/src/test/java/org/bukkit/EffectTest.java
index 54e621e86e8fe3414099494d419929b282b33489..759081f15992e07271567d65250f27f14f6c99c3 100644
index 4344512fa84a2f97a750e06761d8e160c0959f6a..615a4583ef8e70a7c86c28e648d0b57e8e6b9674 100644
--- a/src/test/java/org/bukkit/EffectTest.java
+++ b/src/test/java/org/bukkit/EffectTest.java
@@ -5,10 +5,24 @@ import static org.junit.Assert.*;
import org.junit.Test;
@@ -5,10 +5,24 @@ import static org.hamcrest.CoreMatchers.*;
import org.junit.jupiter.api.Test;
public class EffectTest {
+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); // Paper

View File

@ -107,19 +107,18 @@ index 0000000000000000000000000000000000000000..10430f02e1d1e654383154c04473f074
+}
diff --git a/src/test/java/io/papermc/paper/util/TickTest.java b/src/test/java/io/papermc/paper/util/TickTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..6d6d0564e07c0886648000490337272e1740ea21
index 0000000000000000000000000000000000000000..f147d909f2fc710c1d12bac3c7b66c2883139026
--- /dev/null
+++ b/src/test/java/io/papermc/paper/util/TickTest.java
@@ -0,0 +1,44 @@
@@ -0,0 +1,43 @@
+package io.papermc.paper.util;
+
+import java.time.Duration;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import org.junit.jupiter.api.Test;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class TickTest {
+

View File

@ -113,7 +113,7 @@ index 4d1d81ddc7638e958f9cd1b10fd26227efc1578d..fdb0b8b81e53c85c865c4a3a895719f5
* @param loc The location of a note block
* @param instrument The instrument
diff --git a/src/test/java/org/bukkit/InstrumentTest.java b/src/test/java/org/bukkit/InstrumentTest.java
index 14ad060eba6b78c6b7c7deeecc455ea385b92f36..e3d718d75474c5b31c95bd64cb58247ab72364e4 100644
index 8c1d88885de7d56c1b7c78d2e6e059b0648c982a..b177a47a5bda05bfe3598ec5e6771b92a73f0edf 100644
--- a/src/test/java/org/bukkit/InstrumentTest.java
+++ b/src/test/java/org/bukkit/InstrumentTest.java
@@ -8,9 +8,7 @@ public class InstrumentTest {

View File

@ -28,7 +28,7 @@ index 3df8c60ab5cd1454660980883f80668d535b742b..37c3a00659ce21623be07317f4f6a45b
+/.factorypath
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..91a5d6e9775010336da28ed6e2f6654b0f7248f6
index 0000000000000000000000000000000000000000..398df317e5a84e8916a86209e10c127e23bdd563
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,138 @@
@ -55,8 +55,8 @@ index 0000000000000000000000000000000000000000..91a5d6e9775010336da28ed6e2f6654b
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
+
+ testImplementation("junit:junit:4.13.2")
+ testImplementation("org.hamcrest:hamcrest-library:1.3")
+ testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
+ testImplementation("org.hamcrest:hamcrest:2.2")
+}
+
+val craftbukkitPackageVersion = "1_20_R2" // Paper
@ -172,10 +172,10 @@ index 0000000000000000000000000000000000000000..91a5d6e9775010336da28ed6e2f6654b
+}
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index f71302bc9a652ece0f80ca3e1f00cff46ed50619..0000000000000000000000000000000000000000
index 533f4ac3041ff81a4691591e42f16f710a7d23ac..0000000000000000000000000000000000000000
--- a/pom.xml
+++ /dev/null
@@ -1,590 +0,0 @@
@@ -1,596 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
@ -402,6 +402,12 @@ index f71302bc9a652ece0f80ca3e1f00cff46ed50619..00000000000000000000000000000000
- <artifactId>json-simple</artifactId>
- <version>1.1.1</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.xerial</groupId>
@ -443,15 +449,15 @@ index f71302bc9a652ece0f80ca3e1f00cff46ed50619..00000000000000000000000000000000
- </dependency>
- <!-- testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>5.10.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <version>1.3</version>
- <artifactId>hamcrest</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
- </dependencies>

View File

@ -89,37 +89,37 @@ index fce67663f0a954d9f184c04bf96e23e6fb2ac5eb..c21dd258d749c28e509c86a70c1f8571
private Optional<ResourceLocation> randomSequence;
diff --git a/src/test/java/org/bukkit/DyeColorsTest.java b/src/test/java/org/bukkit/DyeColorsTest.java
index ad52c3fc6210939a39ef77a382c640a24ee44838..6b7dd01778f0a5d3a96d2d04af4b525d17efbfba 100644
index b70450722da13bc4d358a70d3d1d2f30a2cca2b9..86d86c292bdeeb7f42685691287c3b4bd476ea14 100644
--- a/src/test/java/org/bukkit/DyeColorsTest.java
+++ b/src/test/java/org/bukkit/DyeColorsTest.java
@@ -4,7 +4,6 @@ import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
@@ -3,7 +3,6 @@ package org.bukkit;
import static org.bukkit.support.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
-import net.minecraft.world.item.DyeColor;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -29,7 +28,7 @@ public class DyeColorsTest extends AbstractTestingBase {
@Test
public void checkColor() {
Color color = this.dye.getColor();
- float[] nmsColorArray = DyeColor.byId(this.dye.getWoolData()).getTextureDiffuseColors();
+ float[] nmsColorArray = net.minecraft.world.item.DyeColor.byId(this.dye.getWoolData()).getTextureDiffuseColors(); // Paper - remap fix
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
@@ -14,7 +13,7 @@ public class DyeColorsTest extends AbstractTestingBase {
@EnumSource(DyeColor.class)
public void checkColor(DyeColor dye) {
Color color = dye.getColor();
- float[] nmsColorArray = DyeColor.byId(dye.getWoolData()).getTextureDiffuseColors();
+ float[] nmsColorArray = net.minecraft.world.item.DyeColor.byId(dye.getWoolData()).getTextureDiffuseColors(); // Paper - remap fix
Color nmsColor = Color.fromRGB((int) (nmsColorArray[0] * 255), (int) (nmsColorArray[1] * 255), (int) (nmsColorArray[2] * 255));
assertThat(color, is(nmsColor));
}
@@ -37,7 +36,7 @@ public class DyeColorsTest extends AbstractTestingBase {
@Test
public void checkFireworkColor() {
Color color = this.dye.getFireworkColor();
- int nmsColor = DyeColor.byId(this.dye.getWoolData()).getFireworkColor();
+ int nmsColor = net.minecraft.world.item.DyeColor.byId(this.dye.getWoolData()).getFireworkColor(); // Paper - remap fix
@@ -23,7 +22,7 @@ public class DyeColorsTest extends AbstractTestingBase {
@EnumSource(org.bukkit.DyeColor.class)
public void checkFireworkColor(org.bukkit.DyeColor dye) {
Color color = dye.getFireworkColor();
- int nmsColor = DyeColor.byId(dye.getWoolData()).getFireworkColor();
+ int nmsColor = net.minecraft.world.item.DyeColor.byId(dye.getWoolData()).getFireworkColor(); // Paper - remap fix
assertThat(color, is(Color.fromRGB(nmsColor)));
}
}
diff --git a/src/test/java/org/bukkit/RegistryConstantsTest.java b/src/test/java/org/bukkit/RegistryConstantsTest.java
index 34e6b84c63e50972c650c0e4bc17bc0749e1b7c3..cd96cbba4d495c18f984dec6f861f75baf4300cc 100644
index 6be404dafe1f0ae5ab39a0782e4c3ca7c0923752..545a329a52be0dc1f3cf8ca1315152d8b4a465dd 100644
--- a/src/test/java/org/bukkit/RegistryConstantsTest.java
+++ b/src/test/java/org/bukkit/RegistryConstantsTest.java
@@ -19,17 +19,17 @@ public class RegistryConstantsTest extends AbstractTestingBase {
@ -144,17 +144,17 @@ index 34e6b84c63e50972c650c0e4bc17bc0749e1b7c3..cd96cbba4d495c18f984dec6f861f75b
for (Field field : clazz.getFields()) {
diff --git a/src/test/java/org/bukkit/entity/EntityTypesTest.java b/src/test/java/org/bukkit/entity/EntityTypesTest.java
index b1de312e902c83a2f95d80040abb9255e64431a9..aafa6f472c82f851fe7f5ae3111488bb732d0bcc 100644
index 32df0090aab65b551b524603cce0b96e461cc358..952924abae79cc504342bbdb6f6953ab8a6cc295 100644
--- a/src/test/java/org/bukkit/entity/EntityTypesTest.java
+++ b/src/test/java/org/bukkit/entity/EntityTypesTest.java
@@ -5,7 +5,6 @@ import java.util.Set;
@@ -6,7 +6,6 @@ import java.util.Set;
import java.util.stream.Collectors;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
-import net.minecraft.world.entity.EntityType;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
@@ -16,8 +15,8 @@ public class EntityTypesTest extends AbstractTestingBase {
public void testMaps() {
Set<EntityType> allBukkit = Arrays.stream(EntityType.values()).filter((b) -> b.getName() != null).collect(Collectors.toSet());
@ -165,28 +165,31 @@ index b1de312e902c83a2f95d80040abb9255e64431a9..aafa6f472c82f851fe7f5ae3111488bb
+ ResourceLocation key = net.minecraft.world.entity.EntityType.getKey(nms); // Paper - remap fix
org.bukkit.entity.EntityType bukkit = org.bukkit.entity.EntityType.fromName(key.getPath());
Assert.assertNotNull("Missing nms->bukkit " + key, bukkit);
assertNotNull(bukkit, "Missing nms->bukkit " + key);
diff --git a/src/test/java/org/bukkit/entity/PandaGeneTest.java b/src/test/java/org/bukkit/entity/PandaGeneTest.java
index 76e2ad676ae68846bdff3c3ef711751445fb0f3c..feee17192bca55a9cf1b2fc5b9609b888db77763 100644
index 5818bfa69a8573a2a8f350066f829d587cbc546b..8e421a1bee0c526e3024eab9ba4cc0b320842de2 100644
--- a/src/test/java/org/bukkit/entity/PandaGeneTest.java
+++ b/src/test/java/org/bukkit/entity/PandaGeneTest.java
@@ -1,6 +1,5 @@
package org.bukkit.entity;
@@ -2,7 +2,6 @@ package org.bukkit.entity;
import static org.junit.jupiter.api.Assertions.*;
-import net.minecraft.world.entity.animal.Panda;
import org.bukkit.craftbukkit.entity.CraftPanda;
import org.junit.Assert;
import org.junit.Test;
@@ -10,7 +9,7 @@ public class PandaGeneTest {
import org.junit.jupiter.api.Test;
@@ -10,8 +9,8 @@ public class PandaGeneTest {
@Test
public void testBukkit() {
for (Panda.Gene gene : Panda.Gene.values()) {
- for (Panda.Gene gene : Panda.Gene.values()) {
- Panda.Gene nms = CraftPanda.toNms(gene);
+ for (Panda.Gene gene : Panda.Gene.values()) { // Paper - remap fix
+ net.minecraft.world.entity.animal.Panda.Gene nms = CraftPanda.toNms(gene); // Paper - remap fix
Assert.assertNotNull("NMS gene null for " + gene, nms);
Assert.assertEquals("Recessive status did not match " + gene, gene.isRecessive(), nms.isRecessive());
@@ -20,7 +19,7 @@ public class PandaGeneTest {
assertNotNull(nms, "NMS gene null for " + gene);
assertEquals(gene.isRecessive(), nms.isRecessive(), "Recessive status did not match " + gene);
@@ -21,7 +20,7 @@ public class PandaGeneTest {
@Test
public void testNMS() {
@ -194,4 +197,4 @@ index 76e2ad676ae68846bdff3c3ef711751445fb0f3c..feee17192bca55a9cf1b2fc5b9609b88
+ for (net.minecraft.world.entity.animal.Panda.Gene gene : net.minecraft.world.entity.animal.Panda.Gene.values()) { // Paper - remap fix
org.bukkit.entity.Panda.Gene bukkit = CraftPanda.fromNms(gene);
Assert.assertNotNull("Bukkit gene null for " + gene, bukkit);
assertNotNull(bukkit, "Bukkit gene null for " + gene);

View File

@ -9,7 +9,7 @@ public net.minecraft.server.packs.VanillaPackResourcesBuilder safeGetPath(Ljava/
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/build.gradle.kts b/build.gradle.kts
index 91a5d6e9775010336da28ed6e2f6654b0f7248f6..32d475a636d4ba90eeaecfac148143f940cba6e2 100644
index 398df317e5a84e8916a86209e10c127e23bdd563..09bd31c939125f97d7e9ebb2b0376af70a035ab0 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -9,10 +9,9 @@ plugins {
@ -27,8 +27,8 @@ index 91a5d6e9775010336da28ed6e2f6654b0f7248f6..32d475a636d4ba90eeaecfac148143f9
runtimeOnly("com.mysql:mysql-connector-j:8.1.0")
@@ -23,6 +22,8 @@ dependencies {
testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest-library:1.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
testImplementation("org.hamcrest:hamcrest:2.2")
+
+ implementation("io.netty:netty-all:4.1.87.Final"); // Paper - Bump netty
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Test changes
diff --git a/build.gradle.kts b/build.gradle.kts
index 32d475a636d4ba90eeaecfac148143f940cba6e2..b6f741435b7c63d748b79669d3d8f420db52c3a7 100644
index 09bd31c939125f97d7e9ebb2b0376af70a035ab0..46089768685b3bdb0620571de6ce81a17c00f5d5 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -12,6 +12,7 @@ dependencies {
@ -126,7 +126,7 @@ index 0000000000000000000000000000000000000000..c88749e839ee1a9cf8439c4218c8a98a
+ }
+}
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
index 7e665ec6bdf394b98d17687afdb8af9a7a6b0e0f..31d3a6967f509286bcfe1cf55d1a3dc637927e55 100644
index c3c0dff6497ba47604c29a9ff7bcc4692e9ba757..bedb1c43fd9d27eda2411e23d46eb1ad96429507 100644
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
@@ -54,6 +54,7 @@ public abstract class AbstractTestingBase {

View File

@ -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 b6f741435b7c63d748b79669d3d8f420db52c3a7..ba38153a37e864ab7f02a169da3df8806122aa76 100644
index 46089768685b3bdb0620571de6ce81a17c00f5d5..4dfc25fce6ec712838b2a080a649e5c718750a74 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -13,6 +13,7 @@ dependencies {
@ -4873,7 +4873,7 @@ index 0000000000000000000000000000000000000000..0396589795da1f83ddf62426236dde9a
+ }
+}
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
index 31d3a6967f509286bcfe1cf55d1a3dc637927e55..a2f79ff9765e2dcdb7980085c96f12cbbc40e832 100644
index bedb1c43fd9d27eda2411e23d46eb1ad96429507..8174b6bb78553cbe124b499ffa235368179d1564 100644
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
@@ -63,6 +63,7 @@ public abstract class AbstractTestingBase {

View File

@ -4562,7 +4562,7 @@ index 507fa96a3fb904b74429df5756c9a6378ec8c5b7..5c6eb9b6f3ca4fc6534fe023fe78be5c
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 7c33d3d0e55f63b82df30de2e243c42f127272cf..ed81ad09313730173cc5d5617d67da4ae2bf3e78 100644
index fca7eb9d4a91a2dff3ebcc5522b2b0aedac75afc..087080e4df07d87b55b42436cffc2f772d883db3 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -750,6 +750,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@ -5060,7 +5060,7 @@ index 0000000000000000000000000000000000000000..3aedd0bbc97edacc1ebf71264b310e55
+}
diff --git a/src/test/java/io/papermc/paper/adventure/ComponentServicesTest.java b/src/test/java/io/papermc/paper/adventure/ComponentServicesTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..b6c4f8e2d375396a0ef3300a8bc324d77f23a768
index 0000000000000000000000000000000000000000..98114b8fdc441f2a1642abf230457c2b5208bb5c
--- /dev/null
+++ b/src/test/java/io/papermc/paper/adventure/ComponentServicesTest.java
@@ -0,0 +1,23 @@
@ -5070,9 +5070,9 @@ index 0000000000000000000000000000000000000000..b6c4f8e2d375396a0ef3300a8bc324d7
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class ComponentServicesTest {
+

View File

@ -7274,14 +7274,14 @@ index 0000000000000000000000000000000000000000..1d14f530ef888102e47eeeaf0d1a6076
+}
diff --git a/src/test/java/io/papermc/paper/plugin/PluginDependencyValidationTest.java b/src/test/java/io/papermc/paper/plugin/PluginDependencyValidationTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..e08a22a753aba0c83894db7216a50724a9393dfa
index 0000000000000000000000000000000000000000..ad92ae93acd25af4d223a55a0bcbc2a5740390a9
--- /dev/null
+++ b/src/test/java/io/papermc/paper/plugin/PluginDependencyValidationTest.java
@@ -0,0 +1,59 @@
+package io.papermc.paper.plugin;
+
+import io.papermc.paper.plugin.entrypoint.dependency.MetaDependencyTree;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
@ -7339,7 +7339,7 @@ index 0000000000000000000000000000000000000000..e08a22a753aba0c83894db7216a50724
+}
diff --git a/src/test/java/io/papermc/paper/plugin/PluginLoadOrderTest.java b/src/test/java/io/papermc/paper/plugin/PluginLoadOrderTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..9d393aca5e2de4d046dc1a1232d57318432e4742
index 0000000000000000000000000000000000000000..a66fd32cf8af310101161c1b820b3468657460f0
--- /dev/null
+++ b/src/test/java/io/papermc/paper/plugin/PluginLoadOrderTest.java
@@ -0,0 +1,148 @@
@ -7351,9 +7351,9 @@ index 0000000000000000000000000000000000000000..9d393aca5e2de4d046dc1a1232d57318
+import io.papermc.paper.plugin.entrypoint.strategy.modern.ModernPluginLoadingStrategy;
+import io.papermc.paper.plugin.entrypoint.strategy.ProviderConfiguration;
+import io.papermc.paper.plugin.provider.PluginProvider;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
@ -7434,7 +7434,7 @@ index 0000000000000000000000000000000000000000..9d393aca5e2de4d046dc1a1232d57318
+ setup("RedFire", new String[]{"BrightBlueGrass", "BigPaper"}, new String[]{"BlueFire", "GreenGlass", "BigGrass"}, EMPTY);
+ }
+
+ @Before
+ @BeforeEach
+ public void loadProviders() {
+ AtomicInteger currentLoad = new AtomicInteger();
+ ModernPluginLoadingStrategy<PaperTestPlugin> modernPluginLoadingStrategy = new ModernPluginLoadingStrategy<>(new ProviderConfiguration<>() {
@ -7458,16 +7458,16 @@ index 0000000000000000000000000000000000000000..9d393aca5e2de4d046dc1a1232d57318
+ for (PluginProvider<PaperTestPlugin> provider : REGISTERED_PROVIDERS) {
+ TestPluginMeta pluginMeta = (TestPluginMeta) provider.getMeta();
+ String identifier = pluginMeta.getName();
+ Assert.assertTrue("Provider wasn't loaded! (%s)".formatted(identifier), LOAD_ORDER.containsKey(identifier));
+ Assertions.assertTrue(LOAD_ORDER.containsKey(identifier), "Provider wasn't loaded! (%s)".formatted(identifier));
+
+ int index = LOAD_ORDER.get(identifier);
+
+ // Hard dependencies should be loaded BEFORE
+ for (String hardDependency : pluginMeta.getPluginDependencies()) {
+ Assert.assertTrue("Plugin (%s) is missing hard dependency (%s)".formatted(identifier, hardDependency), LOAD_ORDER.containsKey(hardDependency));
+ Assertions.assertTrue(LOAD_ORDER.containsKey(hardDependency), "Plugin (%s) is missing hard dependency (%s)".formatted(identifier, hardDependency));
+
+ int dependencyIndex = LOAD_ORDER.get(hardDependency);
+ Assert.assertTrue("Plugin (%s) was not loaded BEFORE soft dependency. (%s)".formatted(identifier, hardDependency), index > dependencyIndex);
+ Assertions.assertTrue(index > dependencyIndex, "Plugin (%s) was not loaded BEFORE soft dependency. (%s)".formatted(identifier, hardDependency));
+ }
+
+ for (String softDependency : pluginMeta.getPluginSoftDependencies()) {
@ -7477,7 +7477,7 @@ index 0000000000000000000000000000000000000000..9d393aca5e2de4d046dc1a1232d57318
+
+ int dependencyIndex = LOAD_ORDER.get(softDependency);
+
+ Assert.assertTrue("Plugin (%s) was not loaded BEFORE soft dependency. (%s)".formatted(identifier, softDependency), index > dependencyIndex);
+ Assertions.assertTrue(index > dependencyIndex, "Plugin (%s) was not loaded BEFORE soft dependency. (%s)".formatted(identifier, softDependency));
+ }
+
+ for (String loadBefore : pluginMeta.getLoadBeforePlugins()) {
@ -7486,14 +7486,14 @@ index 0000000000000000000000000000000000000000..9d393aca5e2de4d046dc1a1232d57318
+ }
+
+ int dependencyIndex = LOAD_ORDER.get(loadBefore);
+ Assert.assertTrue("Plugin (%s) was NOT loaded BEFORE loadbefore dependency. (%s)".formatted(identifier, loadBefore), index < dependencyIndex);
+ Assertions.assertTrue(index < dependencyIndex, "Plugin (%s) was NOT loaded BEFORE loadbefore dependency. (%s)".formatted(identifier, loadBefore));
+ }
+ }
+ }
+}
diff --git a/src/test/java/io/papermc/paper/plugin/PluginManagerTest.java b/src/test/java/io/papermc/paper/plugin/PluginManagerTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..726eba26470e62b0e94a91418512e242464800ae
index 0000000000000000000000000000000000000000..b7d69dda2b88218221a3cca6db4445cb58aa0179
--- /dev/null
+++ b/src/test/java/io/papermc/paper/plugin/PluginManagerTest.java
@@ -0,0 +1,75 @@
@ -7504,8 +7504,8 @@ index 0000000000000000000000000000000000000000..726eba26470e62b0e94a91418512e242
+import org.bukkit.permissions.Permission;
+import org.bukkit.plugin.PluginManager;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.After;
+import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.*;
@ -7566,7 +7566,7 @@ index 0000000000000000000000000000000000000000..726eba26470e62b0e94a91418512e242
+ assertThat("Permission \"" + name + "\" was not removed", pm.getPermission(name), is(nullValue()));
+ }
+
+ @After
+ @AfterEach
+ public void tearDown() {
+ pm.clearPlugins();
+ assertThat(pm.getPermissions(), is(empty()));
@ -7574,15 +7574,15 @@ index 0000000000000000000000000000000000000000..726eba26470e62b0e94a91418512e242
+}
diff --git a/src/test/java/io/papermc/paper/plugin/PluginNamingTest.java b/src/test/java/io/papermc/paper/plugin/PluginNamingTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..860a2bc8200cf41b216a2e37cfbd2f5464d6542c
index 0000000000000000000000000000000000000000..6c3be5b84ae245652261668a52ce49934ef200a9
--- /dev/null
+++ b/src/test/java/io/papermc/paper/plugin/PluginNamingTest.java
@@ -0,0 +1,28 @@
+package io.papermc.paper.plugin;
+
+import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class PluginNamingTest {
+ private static final String TEST_NAME = "Test_Plugin";
@ -7598,17 +7598,17 @@ index 0000000000000000000000000000000000000000..860a2bc8200cf41b216a2e37cfbd2f54
+
+ @Test
+ public void testName() {
+ Assert.assertEquals(TEST_NAME, this.pluginMeta.getName());
+ Assertions.assertEquals(TEST_NAME, this.pluginMeta.getName());
+ }
+
+ @Test
+ public void testDisplayName() {
+ Assert.assertEquals(TEST_NAME + " v" + TEST_VERSION, this.pluginMeta.getDisplayName());
+ Assertions.assertEquals(TEST_NAME + " v" + TEST_VERSION, this.pluginMeta.getDisplayName());
+ }
+}
diff --git a/src/test/java/io/papermc/paper/plugin/SyntheticEventTest.java b/src/test/java/io/papermc/paper/plugin/SyntheticEventTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..51c08740edffd152c8e2b6d3676ff7f1ce6090c6
index 0000000000000000000000000000000000000000..2a7408ed5d9a415333212cadd7fefcd03785afbf
--- /dev/null
+++ b/src/test/java/io/papermc/paper/plugin/SyntheticEventTest.java
@@ -0,0 +1,42 @@
@ -7619,8 +7619,8 @@ index 0000000000000000000000000000000000000000..51c08740edffd152c8e2b6d3676ff7f1
+import org.bukkit.event.Event;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class SyntheticEventTest {
+
@ -7635,7 +7635,7 @@ index 0000000000000000000000000000000000000000..51c08740edffd152c8e2b6d3676ff7f1
+ paperPluginManager.registerEvents(impl, paperTestPlugin);
+ paperPluginManager.callEvent(event);
+
+ Assert.assertEquals(1, impl.callCount);
+ Assertions.assertEquals(1, impl.callCount);
+ }
+
+ public abstract static class Base<E extends Event> implements Listener {

View File

@ -187,7 +187,7 @@ index 40aad6a209fbded448e3db21207a85d9f2875e71..4dcbd1ed61070c12adf5871a595875ca
static Map<Enchantment, Integer> getEnchantments(net.minecraft.world.item.ItemStack item) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index ed81ad09313730173cc5d5617d67da4ae2bf3e78..bea70b11dcd3039f22b1891f2ea3d86c79367024 100644
index 087080e4df07d87b55b42436cffc2f772d883db3..edcb2ab754b99cdd82ee69b3f61ba9046593955f 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableList;

View File

@ -25,7 +25,7 @@ Other changes:
Co-Authored-By: Emilia Kond <emilia@rymiel.space>
diff --git a/build.gradle.kts b/build.gradle.kts
index ba38153a37e864ab7f02a169da3df8806122aa76..2f562d2fb02d58551338b055a0dd6c05df44e532 100644
index 4dfc25fce6ec712838b2a080a649e5c718750a74..90d61ecdc0760bd81a18fa1d539190853f8da5a3 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -6,9 +6,30 @@ plugins {

View File

@ -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 2f562d2fb02d58551338b055a0dd6c05df44e532..7002a2ccb519ede29244924062f7ed2f49546f7d 100644
index 90d61ecdc0760bd81a18fa1d539190853f8da5a3..c06ed62fb6ce79cd8c1ed45fb4d61a0ded21a01f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -25,7 +25,7 @@ dependencies {

View File

@ -31,15 +31,16 @@ index a8d39b7257332ec8b3b711aab2c4b76a867e73bc..231ba23fabeb88b659a7ea9702eebe4a
}
diff --git a/src/test/java/io/papermc/paper/inventory/item/ExtraArmorSlotTypeMaterialTest.java b/src/test/java/io/papermc/paper/inventory/item/ExtraArmorSlotTypeMaterialTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..36cde1a68b0fb388cca40399fcb4297b4d799262
index 0000000000000000000000000000000000000000..0d99bef54594f9c5eda5c19063be765783e89fdd
--- /dev/null
+++ b/src/test/java/io/papermc/paper/inventory/item/ExtraArmorSlotTypeMaterialTest.java
@@ -0,0 +1,53 @@
@@ -0,0 +1,47 @@
+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.world.entity.EquipmentSlot;
+import net.minecraft.world.item.Equipable;
+import net.minecraft.world.item.Item;
@ -47,58 +48,52 @@ index 0000000000000000000000000000000000000000..36cde1a68b0fb388cca40399fcb4297b
+import org.bukkit.Material;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@RunWith(Parameterized.class)
+public class ExtraArmorSlotTypeMaterialTest extends AbstractTestingBase {
+
+ @Parameterized.Parameter(0)
+ public PlayerArmorChangeEvent.SlotType slotType;
+
+ @Parameterized.Parameter(1)
+ public Material item;
+
+ @Parameterized.Parameters(name = "{0}: {1}")
+ public static Iterable<Object[]> parameters() {
+ @MethodSource("parameters")
+ public static Stream<Object[]> parameters() {
+ final List<Object[]> parameters = new ArrayList<>();
+ for (final PlayerArmorChangeEvent.SlotType slotType : PlayerArmorChangeEvent.SlotType.values()) {
+ for (final Material item : slotType.getTypes()) {
+ parameters.add(new Object[]{ slotType, item });
+ }
+ }
+ return parameters;
+ return parameters.stream();
+ }
+
+ @Test
+ public void test() {
+ final Item nmsItem = CraftMagicNumbers.getItem(this.item);
+ @ParameterizedTest
+ @MethodSource("parameters")
+ public void test(PlayerArmorChangeEvent.SlotType slotType, Material item) {
+ final Item nmsItem = CraftMagicNumbers.getItem(item);
+ final Equipable equipable = Equipable.get(new ItemStack(nmsItem));
+ assertNotNull(this.item + " isn't equipable", equipable);
+ final EquipmentSlot slot = switch (this.slotType) {
+ assertNotNull(equipable, item + " isn't equipable");
+ final EquipmentSlot slot = switch (slotType) {
+ case HEAD -> EquipmentSlot.HEAD;
+ case CHEST -> EquipmentSlot.CHEST;
+ case LEGS -> EquipmentSlot.LEGS;
+ case FEET -> EquipmentSlot.FEET;
+ };
+ assertEquals(this.item + " isn't set to the right slot", equipable.getEquipmentSlot(), slot);
+ 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..f05cfe2e4a9f876a7e6425c612a56f86d5ac3915
index 0000000000000000000000000000000000000000..f2a9515228e4e3af27fce4f30fa4f4a5f0629a1e
--- /dev/null
+++ b/src/test/java/io/papermc/paper/inventory/item/MissingArmorSlotTypeMaterialTest.java
@@ -0,0 +1,57 @@
@@ -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;
@ -106,39 +101,32 @@ index 0000000000000000000000000000000000000000..f05cfe2e4a9f876a7e6425c612a56f86
+import net.minecraft.world.item.ItemStack;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Test for {@link com.destroystokyo.paper.event.player.PlayerArmorChangeEvent.SlotType}
+ */
+@RunWith(Parameterized.class)
+public class MissingArmorSlotTypeMaterialTest extends AbstractTestingBase {
+
+ @Parameterized.Parameter(0)
+ public Equipable equipable;
+
+ @Parameterized.Parameter(1)
+ public Item item;
+
+ @Parameterized.Parameters(name = "{1}")
+ public static Iterable<Object[]> parameters() {
+ @MethodSource("parameters")
+ public static Stream<Object[]> parameters() {
+ final List<Object[]> parameters = new ArrayList<>();
+ for (final Item item : BuiltInRegistries.ITEM) {
+ final Equipable equipable = Equipable.get(new ItemStack(item));
+ if (equipable != null) {
+ parameters.add(new Object[]{ equipable, item });
+ parameters.add(new Object[]{equipable, item});
+ }
+ }
+ return parameters;
+ return parameters.stream();
+ }
+
+ @Test
+ public void test() {
+ final EquipmentSlot equipmentSlot = this.equipable.getEquipmentSlot();
+ @ParameterizedTest
+ @MethodSource("parameters")
+ public void test(Equipable equipable, Item item) {
+ final EquipmentSlot equipmentSlot = equipable.getEquipmentSlot();
+ PlayerArmorChangeEvent.SlotType slotType = switch (equipmentSlot) {
+ case HEAD -> PlayerArmorChangeEvent.SlotType.HEAD;
+ case CHEST -> PlayerArmorChangeEvent.SlotType.CHEST;
@ -147,7 +135,7 @@ index 0000000000000000000000000000000000000000..f05cfe2e4a9f876a7e6425c612a56f86
+ default -> null;
+ };
+ if (slotType != null) {
+ assertTrue("SlotType " + slotType + " doesn't include " + this.item, slotType.getTypes().contains(CraftMagicNumbers.getMaterial(this.item)));
+ assertTrue(slotType.getTypes().contains(CraftMagicNumbers.getMaterial(item)), "SlotType " + slotType + " doesn't include " + item);
+ }
+ }
+}

View File

@ -149,12 +149,12 @@ index a69a03a7954b03a0aeca7a74d89756dd38ca6faf..17e1131c79ad140c0803a914621ce792
public static BlockState getBlockState(Material material, @Nullable CompoundTag blockEntityTag) {
diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
index 6c559b0d7b3d8b95276d16a6af4975fd44de3334..a94389eebe51bb368f759b3f99f0b9ed08ae2bdd 100644
index 759e95434a1f18ec0b829a29071ab62a42550279..1c33e3456c410dac3ac2f0caef52ee24e00ffca5 100644
--- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
@@ -156,4 +156,10 @@ public class CraftPersistentDataContainer implements PersistentDataContainer {
public Map<String, Object> serialize() {
return (Map<String, Object>) CraftNBTTagConfigSerializer.serialize(this.toTagCompound());
public String serialize() {
return CraftNBTTagConfigSerializer.serialize(this.toTagCompound());
}
+
+ // Paper start

View File

@ -255,7 +255,7 @@ index 4017933f2244fca32cf9d39444f3a4f550e8af01..e721517ce7b52a1aa10d039aa9f309eb
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index bea70b11dcd3039f22b1891f2ea3d86c79367024..157459f8e9772216229b132f5b9247bcb761072f 100644
index edcb2ab754b99cdd82ee69b3f61ba9046593955f..b29b2d3917fbc5c611ebce17fa2f869203c4514e 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -1463,6 +1463,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@ -274,10 +274,10 @@ index bea70b11dcd3039f22b1891f2ea3d86c79367024..157459f8e9772216229b132f5b9247bc
CraftMetaCompass.LODESTONE_POS.NBT,
CraftMetaCompass.LODESTONE_TRACKED.NBT,
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
index 8b7a9ea385788580cc99db5b2182e849bedc262f..4400f10a592b86488e61521a4fce61adbf656cb9 100644
index ac3b9ab1f81ddb796bdffb26c00afe75ef1a606c..3effe3c3b7ad949bc786e1b6e560553f2ca3f233 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
@@ -364,6 +364,7 @@ public class ItemMetaTest extends AbstractTestingBase {
@@ -365,6 +365,7 @@ public class ItemMetaTest extends AbstractTestingBase {
final CraftMetaArmorStand meta = (CraftMetaArmorStand) cleanStack.getItemMeta();
meta.entityTag = new CompoundTag();
meta.entityTag.putBoolean("Small", true);

View File

@ -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 7002a2ccb519ede29244924062f7ed2f49546f7d..7cb7a4024f53c50d88652cb6c497d815ed67c148 100644
index c06ed62fb6ce79cd8c1ed45fb4d61a0ded21a01f..b092384b34986b0826fa62530ffaeb0fcd80cdc6 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -38,6 +38,7 @@ dependencies {

View File

@ -24,28 +24,28 @@ index 00bdaff22deab7a9f328670917fe2bae01e37a73..cee7a93cd516ed8f483fd29dfcd6a54f
static boolean hasItemMeta(net.minecraft.world.item.ItemStack item) {
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
index 4400f10a592b86488e61521a4fce61adbf656cb9..7cc7f485325a4277bac7a6eade749dbb3b0b104f 100644
index 3effe3c3b7ad949bc786e1b6e560553f2ca3f233..937ddd3a2b9e1df2c8835079923c339178f08459 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
@@ -107,6 +107,34 @@ public class ItemMetaTest extends AbstractTestingBase {
@@ -108,6 +108,34 @@ public class ItemMetaTest extends AbstractTestingBase {
assertThat(itemMeta.hasConflictingEnchant(null), is(false));
}
+ // Paper start
+ private void testItemMeta(ItemStack stack) {
+ assertThat("Should not have ItemMeta", stack.hasItemMeta(), is(false));
+ assertThat(stack.hasItemMeta(), is(false), "Should not have ItemMeta");
+
+ stack.setDurability((short) 0);
+ assertThat("ItemStack with zero durability should not have ItemMeta", stack.hasItemMeta(), is(false));
+ assertThat(stack.hasItemMeta(), is(false), "ItemStack with zero durability should not have ItemMeta");
+
+ stack.setDurability((short) 2);
+ assertThat("ItemStack with non-zero durability should have ItemMeta", stack.hasItemMeta(), is(true));
+ assertThat(stack.hasItemMeta(), is(true), "ItemStack with non-zero durability should have ItemMeta");
+
+ stack.setLore(java.util.Collections.singletonList("Lore"));
+ assertThat("ItemStack with lore and durability should have ItemMeta", stack.hasItemMeta(), is(true));
+ assertThat(stack.hasItemMeta(), is(true), "ItemStack with lore and durability should have ItemMeta");
+
+ stack.setDurability((short) 0);
+ assertThat("ItemStack with lore should have ItemMeta", stack.hasItemMeta(), is(true));
+ assertThat(stack.hasItemMeta(), is(true), "ItemStack with lore should have ItemMeta");
+
+ stack.setLore(null);
+ }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Implement an API for CanPlaceOn and CanDestroy NBT values
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 157459f8e9772216229b132f5b9247bcb761072f..abccd9cb31c529142b64783873368fab7b38d312 100644
index b29b2d3917fbc5c611ebce17fa2f869203c4514e..907a584257ff4145b064f835d6396918cff6fa75 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -84,6 +84,12 @@ import org.bukkit.persistence.PersistentDataContainer;

View File

@ -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 7cb7a4024f53c50d88652cb6c497d815ed67c148..7f005b9a41064f1929e8d9cb53c5ab207d3a333d 100644
index b092384b34986b0826fa62530ffaeb0fcd80cdc6..5ecadb31e64964f5706cc4bf0f4fd98195388116 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -14,6 +14,7 @@ val alsoShade: Configuration by configurations.creating

View File

@ -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..fab3063fffa959ac7f0eb5937f2fae94d11b6591
index 0000000000000000000000000000000000000000..825a98cf66d293ef90f33b2fe4a23f6bd9f100fa
--- /dev/null
+++ b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
@@ -0,0 +1,18 @@
@ -158,8 +158,8 @@ index 0000000000000000000000000000000000000000..fab3063fffa959ac7f0eb5937f2fae94
+import com.destroystokyo.paper.ClientOption;
+import net.minecraft.world.entity.player.ChatVisiblity;
+import org.bukkit.Difficulty;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class TranslationKeyTest {
+
@ -167,7 +167,7 @@ index 0000000000000000000000000000000000000000..fab3063fffa959ac7f0eb5937f2fae94
+ public void testChatVisibilityKeys() {
+ for (ClientOption.ChatVisibility chatVisibility : ClientOption.ChatVisibility.values()) {
+ if (chatVisibility == ClientOption.ChatVisibility.UNKNOWN) continue;
+ Assert.assertEquals(chatVisibility + "'s translation key doesn't match", ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey());
+ Assertions.assertEquals(chatVisibility + "'s translation key doesn't match", ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey());
+ }
+ }
+}

View File

@ -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 7f005b9a41064f1929e8d9cb53c5ab207d3a333d..dfb43cf7be60733f3ab142de66139971bca1b1fe 100644
index 5ecadb31e64964f5706cc4bf0f4fd98195388116..c26ae39f0d78a4a2427681d1c8fc60c19374155e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -37,6 +37,7 @@ dependencies {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Implement Mob Goal API
diff --git a/build.gradle.kts b/build.gradle.kts
index dfb43cf7be60733f3ab142de66139971bca1b1fe..b81b99a7767e3b0d3549e49529e98efdb7334101 100644
index c26ae39f0d78a4a2427681d1c8fc60c19374155e..ace5cd8aa4fc2a555673b75adb910a1ede3f57fc 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -46,6 +46,7 @@ dependencies {
@ -13,8 +13,8 @@ index dfb43cf7be60733f3ab142de66139971bca1b1fe..b81b99a7767e3b0d3549e49529e98efd
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
+ testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest-library:1.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
testImplementation("org.hamcrest:hamcrest:2.2")
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
new file mode 100644
@ -809,26 +809,25 @@ index 633cd70f8390c4aa9a9b52054f8b58106ae079e6..83ff2373ba5ec4b862170e0c1ff2d84d
}
diff --git a/src/test/java/com/destroystokyo/paper/entity/ai/VanillaMobGoalTest.java b/src/test/java/com/destroystokyo/paper/entity/ai/VanillaMobGoalTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..b2d510459bcf90a3611f3d91dae4ccc3d29b4079
index 0000000000000000000000000000000000000000..654ed436e99dd56f1fe7c1d4f38da34d95ce9349
--- /dev/null
+++ b/src/test/java/com/destroystokyo/paper/entity/ai/VanillaMobGoalTest.java
@@ -0,0 +1,103 @@
@@ -0,0 +1,106 @@
+package com.destroystokyo.paper.entity.ai;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import io.github.classgraph.ClassGraph;
+import io.github.classgraph.ScanResult;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.bukkit.entity.Mob;
+import org.junit.jupiter.api.Test;
+
+import io.github.classgraph.ClassGraph;
+import io.github.classgraph.ScanResult;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.fail;
+
+public class VanillaMobGoalTest {
+
@ -889,7 +888,9 @@ index 0000000000000000000000000000000000000000..b2d510459bcf90a3611f3d91dae4ccc3
+ deprecated.forEach(System.out::println);
+ }
+
+ if (shouldFail) Assert.fail("See above");
+ if (shouldFail) {
+ fail("See above");
+ }
+ }
+
+ private static boolean hasNoEnclosingClass(Class<?> clazz) {
@ -902,7 +903,7 @@ index 0000000000000000000000000000000000000000..b2d510459bcf90a3611f3d91dae4ccc3
+ try (ScanResult scanResult = new ClassGraph().enableAllInfo().whitelistPackages("net.minecraft.world.entity").scan()) {
+ classes = scanResult.getSubclasses("net.minecraft.world.entity.Mob").loadClasses();
+ }
+ Assert.assertNotEquals("There are supposed to be more than 0 entity types!", Collections.emptyList(), classes);
+ assertNotEquals(Collections.emptyList(), classes, "There are supposed to be more than 0 entity types!");
+
+ boolean shouldFail = false;
+ for (Class<?> nmsClass : classes) {
@ -913,6 +914,8 @@ index 0000000000000000000000000000000000000000..b2d510459bcf90a3611f3d91dae4ccc3
+ }
+ }
+
+ if (shouldFail) Assert.fail("See above");
+ if (shouldFail) {
+ fail("See above");
+ }
+ }
+}

View File

@ -30,7 +30,7 @@ index d4dba8c733c7560e5108b8d239b52e593f8debec..ea48f1119a940056c37d1d203437bfbf
public CraftAttributeMap(AttributeMap handle) {
this.handle = handle;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index abccd9cb31c529142b64783873368fab7b38d312..224b7336b2b80c6810b45fe78c8d8ce581a53b4e 100644
index 907a584257ff4145b064f835d6396918cff6fa75..5b370696759d6b7269d89d747520f1c41e5dbe2c 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -484,7 +484,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Support components in ItemMeta
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 224b7336b2b80c6810b45fe78c8d8ce581a53b4e..76b4c43343fd3ee13662ac7cd6e0e5ae4df0d615 100644
index 5b370696759d6b7269d89d747520f1c41e5dbe2c..03639ba2ad9c91a96e6fd46f023c101a63b760e8 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -878,11 +878,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {

View File

@ -13,10 +13,10 @@ This commit forces numbers to be present prior to the ending "i"
letter.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java b/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java
index a7f4054002bd176fccf8357e9a23de66dd9e0dc5..207e4302161b3abe2ade56c9dc9c31820010fa42 100644
index 2cfa312aec7fe513b9f0e517fa935cd8aceeb868..eea35e63fcbb598b6c89625e69160a46891ceb5f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java
@@ -19,7 +19,7 @@ import net.minecraft.nbt.TagParser;
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
public class CraftNBTTagConfigSerializer {
private static final Pattern ARRAY = Pattern.compile("^\\[.*]");

View File

@ -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 fab3063fffa959ac7f0eb5937f2fae94d11b6591..59ebc5aaa60aaca843e6775a17cdf04f5b3aefaa 100644
index 825a98cf66d293ef90f33b2fe4a23f6bd9f100fa..8258a0bfff26a49935606b85b41bdb0b6a207aec 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 @@
@ -64,9 +64,9 @@ index fab3063fffa959ac7f0eb5937f2fae94d11b6591..59ebc5aaa60aaca843e6775a17cdf04f
+import org.bukkit.attribute.Attribute;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
+import org.bukkit.support.AbstractTestingBase;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-public class TranslationKeyTest {
+public class TranslationKeyTest extends AbstractTestingBase {
@ -74,44 +74,44 @@ index fab3063fffa959ac7f0eb5937f2fae94d11b6591..59ebc5aaa60aaca843e6775a17cdf04f
@Test
public void testChatVisibilityKeys() {
@@ -15,4 +30,67 @@ public class TranslationKeyTest {
Assert.assertEquals(chatVisibility + "'s translation key doesn't match", ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey());
Assertions.assertEquals(chatVisibility + "'s translation key doesn't match", ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey());
}
}
+
+ @Test
+ public void testDifficultyKeys() {
+ for (Difficulty bukkitDifficulty : Difficulty.values()) {
+ Assert.assertEquals(bukkitDifficulty + "'s translation key doesn't match", ((TranslatableContents) net.minecraft.world.Difficulty.byId(bukkitDifficulty.ordinal()).getDisplayName().getContents()).getKey(), bukkitDifficulty.translationKey());
+ Assertions.assertEquals(bukkitDifficulty + "'s translation key doesn't match", ((TranslatableContents) net.minecraft.world.Difficulty.byId(bukkitDifficulty.ordinal()).getDisplayName().getContents()).getKey(), bukkitDifficulty.translationKey());
+ }
+ }
+
+ @Test
+ public void testGameruleKeys() {
+ for (GameRule<?> rule : GameRule.values()) {
+ Assert.assertEquals(rule.getName() + "'s translation doesn't match", org.bukkit.craftbukkit.CraftWorld.getGameRulesNMS().get(rule.getName()).getDescriptionId(), rule.translationKey());
+ Assertions.assertEquals(rule.getName() + "'s translation doesn't match", org.bukkit.craftbukkit.CraftWorld.getGameRulesNMS().get(rule.getName()).getDescriptionId(), rule.translationKey());
+ }
+ }
+
+ @Test
+ public void testAttributeKeys() {
+ for (Attribute attribute : Attribute.values()) {
+ Assert.assertEquals("translation key mismatch for " + attribute, org.bukkit.craftbukkit.attribute.CraftAttribute.bukkitToMinecraft(attribute).getDescriptionId(), attribute.translationKey());
+ Assertions.assertEquals("translation key mismatch for " + attribute, org.bukkit.craftbukkit.attribute.CraftAttribute.bukkitToMinecraft(attribute).getDescriptionId(), attribute.translationKey());
+ }
+ }
+
+ @Test
+ public void testFireworkEffectType() {
+ for (FireworkEffect.Type type : FireworkEffect.Type.values()) {
+ Assert.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("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));
+ }
+ }
+
+ @Test
+ @Ignore // TODO fix
+ @Disabled // TODO fix
+ public void testCreativeCategory() {
+ // for (CreativeModeTab tab : CreativeModeTabs.tabs()) {
+ // CreativeCategory category = Objects.requireNonNull(CraftCreativeCategory.fromNMS(tab));
+ // Assert.assertEquals("translation key mismatch for " + category, ((TranslatableContents) tab.getDisplayName().getContents()).getKey(), category.translationKey());
+ // Assertions.assertEquals("translation key mismatch for " + category, ((TranslatableContents) tab.getDisplayName().getContents()).getKey(), category.translationKey());
+ // }
+ }
+
@ -119,8 +119,8 @@ index fab3063fffa959ac7f0eb5937f2fae94d11b6591..59ebc5aaa60aaca843e6775a17cdf04f
+ public void testGameMode() {
+ for (GameType nms : GameType.values()) {
+ GameMode bukkit = GameMode.getByValue(nms.getId());
+ Assert.assertNotNull(bukkit);
+ Assert.assertEquals("translation key mismatch for " + bukkit, ((TranslatableContents) nms.getLongDisplayName().getContents()).getKey(), bukkit.translationKey());
+ Assertions.assertNotNull(bukkit);
+ Assertions.assertEquals("translation key mismatch for " + bukkit, ((TranslatableContents) nms.getLongDisplayName().getContents()).getKey(), bukkit.translationKey());
+ }
+ }
+
@ -128,7 +128,7 @@ index fab3063fffa959ac7f0eb5937f2fae94d11b6591..59ebc5aaa60aaca843e6775a17cdf04f
+ 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());
+ Assert.assertEquals("translation key mismatch for " + bukkit, nms.getKey().location().toLanguageKey("biome"), bukkit.translationKey());
+ Assertions.assertEquals("translation key mismatch for " + bukkit, nms.getKey().location().toLanguageKey("biome"), bukkit.translationKey());
+ }
+ }
+
@ -136,8 +136,8 @@ index fab3063fffa959ac7f0eb5937f2fae94d11b6591..59ebc5aaa60aaca843e6775a17cdf04f
+ public void testMusicInstrument() {
+ for (final ResourceLocation nms : BuiltInRegistries.INSTRUMENT.keySet()) {
+ final MusicInstrument bukkit = MusicInstrument.getByKey(CraftNamespacedKey.fromMinecraft(nms));
+ Assert.assertNotNull("Missing bukkit instrument for " + nms, bukkit);
+ Assert.assertEquals("translation key mismatch for " + bukkit, nms.toLanguageKey("instrument"), bukkit.translationKey());
+ Assertions.assertNotNull(bukkit, "Missing bukkit instrument for " + nms);
+ Assertions.assertEquals("translation key mismatch for " + bukkit, nms.toLanguageKey("instrument"), bukkit.translationKey());
+ }
+ }
}

View File

@ -86,7 +86,7 @@ index ca30f9c590f792caa8f1b76d7219e9121d932673..74ffea16027ba8eaa26716c3b6b78a8e
diff --git a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..4f43882d930ab8816e75b216d9a61a06b79df265
index 0000000000000000000000000000000000000000..afeb4271fffb7546209f1e651214065187c88302
--- /dev/null
+++ b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
@@ -0,0 +1,82 @@
@ -104,9 +104,9 @@ index 0000000000000000000000000000000000000000..4f43882d930ab8816e75b216d9a61a06
+import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
+import org.bukkit.permissions.Permission;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.io.PrintStream;
+import java.util.HashSet;
@ -115,12 +115,12 @@ index 0000000000000000000000000000000000000000..4f43882d930ab8816e75b216d9a61a06
+import java.util.Set;
+import java.util.TreeSet;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class MinecraftCommandPermissionsTest extends AbstractTestingBase {
+
+ private static PrintStream old;
+ @BeforeClass
+ @BeforeAll
+ public static void before() {
+ old = System.out;
+ System.setOut(Bootstrap.STDOUT);
@ -143,9 +143,9 @@ index 0000000000000000000000000000000000000000..4f43882d930ab8816e75b216d9a61a06
+ foundPerms.add(vanillaPerm);
+ }
+ }
+ assertTrue("Commands missing permissions: \n" + String.join("\n", missing), missing.isEmpty());
+ assertTrue(missing.isEmpty(), "Commands missing permissions: \n" + String.join("\n", missing));
+ perms.removeAll(foundPerms);
+ assertTrue("Extra permissions not associated with a command: \n" + String.join("\n", perms), perms.isEmpty());
+ assertTrue(perms.isEmpty(), "Extra permissions not associated with a command: \n" + String.join("\n", perms));
+ }
+
+ private static final List<String> TO_SKIP = List.of(
@ -165,7 +165,7 @@ index 0000000000000000000000000000000000000000..4f43882d930ab8816e75b216d9a61a06
+ return perms;
+ }
+
+ @AfterClass
+ @AfterAll
+ public static void after() {
+ if (old != null) {
+ System.setOut(old);

View File

@ -93,7 +93,7 @@ index 582e509dddfdf6e7b8a2d7310caba076c3bd7dc2..3d17c2b6fdfe24cf9aed90649264bdb5
}
diff --git a/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java b/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..102b99691b53f5e3c14999d3c281b0301b9665d5
index 0000000000000000000000000000000000000000..cc24d5746b96d8ac352a3ed0a675a7b159f8bd65
--- /dev/null
+++ b/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java
@@ -0,0 +1,96 @@
@ -110,9 +110,9 @@ index 0000000000000000000000000000000000000000..102b99691b53f5e3c14999d3c281b030
+import org.bukkit.NamespacedKey;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.io.PrintStream;
+import java.lang.reflect.Field;
@ -121,9 +121,9 @@ index 0000000000000000000000000000000000000000..102b99691b53f5e3c14999d3c281b030
+import java.util.Map;
+import java.util.StringJoiner;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@Deprecated(forRemoval = true)
+public class ConfiguredStructureTest extends AbstractTestingBase {
@ -133,7 +133,7 @@ index 0000000000000000000000000000000000000000..102b99691b53f5e3c14999d3c281b030
+
+ private static PrintStream out;
+
+ @BeforeClass
+ @BeforeAll
+ public static void collectStructures() throws ReflectiveOperationException {
+ out = System.out;
+ System.setOut(Bootstrap.STDOUT);
@ -153,12 +153,12 @@ index 0000000000000000000000000000000000000000..102b99691b53f5e3c14999d3c281b030
+ @Test
+ public void testMinecraftToApi() {
+ Registry<Structure> structureRegistry = AbstractTestingBase.REGISTRY_CUSTOM.registryOrThrow(Registries.STRUCTURE);
+ assertEquals("configured structure maps should be the same size", BUILT_IN_STRUCTURES.size(), structureRegistry.size());
+ assertEquals(BUILT_IN_STRUCTURES.size(), structureRegistry.size(), "configured structure maps should be the same size");
+
+ Map<ResourceLocation, Structure> missing = new LinkedHashMap<>();
+ for (Structure feature : structureRegistry) {
+ final ResourceLocation key = structureRegistry.getKey(feature);
+ assertNotNull("Missing built-in registry key", key);
+ assertNotNull(key, "Missing built-in registry key");
+ if (key.equals(BuiltinStructures.ANCIENT_CITY.location()) || key.equals(BuiltinStructures.TRAIL_RUINS.location())) {
+ continue; // TODO remove when upstream adds "jigsaw" StructureType
+ }
@ -167,14 +167,14 @@ index 0000000000000000000000000000000000000000..102b99691b53f5e3c14999d3c281b030
+ }
+ }
+
+ assertTrue(printMissing(missing), missing.isEmpty());
+ assertTrue(missing.isEmpty(), printMissing(missing));
+ }
+
+ @Test
+ public void testApiToMinecraft() {
+ Registry<Structure> structureRegistry = AbstractTestingBase.REGISTRY_CUSTOM.registryOrThrow(Registries.STRUCTURE);
+ for (NamespacedKey apiKey : DEFAULT_CONFIGURED_STRUCTURES.keySet()) {
+ assertTrue(apiKey + " does not have a minecraft counterpart", structureRegistry.containsKey(CraftNamespacedKey.toMinecraft(apiKey)));
+ assertTrue(structureRegistry.containsKey(CraftNamespacedKey.toMinecraft(apiKey)), apiKey + " does not have a minecraft counterpart");
+ }
+ }
+
@ -188,7 +188,7 @@ index 0000000000000000000000000000000000000000..102b99691b53f5e3c14999d3c281b030
+ return joiner.toString();
+ }
+
+ @AfterClass
+ @AfterAll
+ public static void after() {
+ System.setOut(out);
+ }

View File

@ -33,7 +33,7 @@ index 8a2b8f8b36e54b97fa2518eb54c31da8fe0d6d67..2039442d5d7f99e6589e4625a76ebbc6
/**
diff --git a/src/test/java/io/papermc/paper/inventory/ItemRarityTest.java b/src/test/java/io/papermc/paper/inventory/ItemRarityTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..38e6d42098f216b1d24f50386e7be98181122d8d
index 0000000000000000000000000000000000000000..d310f86c57e4521ad7666d3f738f53ac83d221f2
--- /dev/null
+++ b/src/test/java/io/papermc/paper/inventory/ItemRarityTest.java
@@ -0,0 +1,24 @@
@ -41,23 +41,23 @@ index 0000000000000000000000000000000000000000..38e6d42098f216b1d24f50386e7be981
+
+import io.papermc.paper.adventure.PaperAdventure;
+import net.minecraft.world.item.Rarity;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class ItemRarityTest {
+
+ @Test
+ public void testConvertFromNmsToBukkit() {
+ for (Rarity nmsRarity : Rarity.values()) {
+ assertEquals("rarity names are mis-matched", ItemRarity.values()[nmsRarity.ordinal()].name(), nmsRarity.name());
+ assertEquals(ItemRarity.values()[nmsRarity.ordinal()].name(), nmsRarity.name(), "rarity names are mis-matched");
+ }
+ }
+
+ @Test
+ public void testRarityFormatting() {
+ for (Rarity nmsRarity : Rarity.values()) {
+ assertEquals("rarity formatting is mis-matched", nmsRarity.color, PaperAdventure.asVanilla(ItemRarity.values()[nmsRarity.ordinal()].color));
+ assertEquals(nmsRarity.color, PaperAdventure.asVanilla(ItemRarity.values()[nmsRarity.ordinal()].color), "rarity formatting is mis-matched");
+ }
+ }
+}

View File

@ -25,7 +25,7 @@ index aed137c6857190e6dad62ab70ae0be3613f3bea3..794c1da115ccfa26fd77f7b28406e629
return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion();
diff --git a/src/test/java/io/papermc/paper/util/ItemStackRepairCheckTest.java b/src/test/java/io/papermc/paper/util/ItemStackRepairCheckTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..8d9c9b3bd53d407391d4fcb7fc773153d1a7b402
index 0000000000000000000000000000000000000000..6b8d360ef86e181a680ad77f28b7dd7368dddfe7
--- /dev/null
+++ b/src/test/java/io/papermc/paper/util/ItemStackRepairCheckTest.java
@@ -0,0 +1,48 @@
@ -34,11 +34,11 @@ index 0000000000000000000000000000000000000000..8d9c9b3bd53d407391d4fcb7fc773153
+import org.bukkit.Material;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class ItemStackRepairCheckTest extends AbstractTestingBase {
+
@ -46,34 +46,34 @@ index 0000000000000000000000000000000000000000..8d9c9b3bd53d407391d4fcb7fc773153
+ public void testIsRepariableBy() {
+ ItemStack diamondPick = new ItemStack(Material.DIAMOND_PICKAXE);
+
+ assertTrue("diamond pick isn't repairable by a diamond", diamondPick.isRepairableBy(new ItemStack(Material.DIAMOND)));
+ assertTrue(diamondPick.isRepairableBy(new ItemStack(Material.DIAMOND)), "diamond pick isn't repairable by a diamond");
+ }
+
+ @Test
+ public void testCanRepair() {
+ ItemStack diamond = new ItemStack(Material.DIAMOND);
+
+ assertTrue("diamond can't repair a diamond axe", diamond.canRepair(new ItemStack(Material.DIAMOND_AXE)));
+ assertTrue(diamond.canRepair(new ItemStack(Material.DIAMOND_AXE)), "diamond can't repair a diamond axe");
+ }
+
+ @Test
+ public void testIsNotRepairableBy() {
+ ItemStack notDiamondPick = new ItemStack(Material.ACACIA_SAPLING);
+
+ assertFalse("acacia sapling is repairable by a diamond", notDiamondPick.isRepairableBy(new ItemStack(Material.DIAMOND)));
+ assertFalse(notDiamondPick.isRepairableBy(new ItemStack(Material.DIAMOND)), "acacia sapling is repairable by a diamond");
+ }
+
+ @Test
+ public void testCanNotRepair() {
+ ItemStack diamond = new ItemStack(Material.DIAMOND);
+
+ assertFalse("diamond can repair oak button", diamond.canRepair(new ItemStack(Material.OAK_BUTTON)));
+ assertFalse(diamond.canRepair(new ItemStack(Material.OAK_BUTTON)), "diamond can repair oak button");
+ }
+
+ @Test
+ public void testInvalidItem() {
+ ItemStack badItemStack = new ItemStack(Material.ACACIA_WALL_SIGN);
+
+ assertFalse("acacia wall sign is repairable by diamond", badItemStack.isRepairableBy(new ItemStack(Material.DIAMOND)));
+ assertFalse(badItemStack.isRepairableBy(new ItemStack(Material.DIAMOND)), "acacia wall sign is repairable by diamond");
+ }
+}

View File

@ -93,7 +93,7 @@ index fac638e0eab8c50e6afd0ceee6f9d051127221eb..65f516044128328e7729c971a4a299cc
}
diff --git a/src/test/java/io/papermc/paper/enchantments/EnchantmentRarityTest.java b/src/test/java/io/papermc/paper/enchantments/EnchantmentRarityTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..62b56b5b43696b03fc72cac59f986d006edc3f76
index 0000000000000000000000000000000000000000..03a53ceb0dc3aaff7b5d10ec57f74d71be90ec3a
--- /dev/null
+++ b/src/test/java/io/papermc/paper/enchantments/EnchantmentRarityTest.java
@@ -0,0 +1,18 @@
@ -101,9 +101,9 @@ index 0000000000000000000000000000000000000000..62b56b5b43696b03fc72cac59f986d00
+
+import net.minecraft.world.item.enchantment.Enchantment.Rarity;
+import org.bukkit.craftbukkit.enchantments.CraftEnchantment;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+public class EnchantmentRarityTest {
+
@ -117,7 +117,7 @@ index 0000000000000000000000000000000000000000..62b56b5b43696b03fc72cac59f986d00
+}
diff --git a/src/test/java/io/papermc/paper/entity/EntityCategoryTest.java b/src/test/java/io/papermc/paper/entity/EntityCategoryTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..b9824b1f9491304ceb91be18f4f3b3068526bb33
index 0000000000000000000000000000000000000000..4ee48ef89f0e31a7bda4b04453fca8177874f540
--- /dev/null
+++ b/src/test/java/io/papermc/paper/entity/EntityCategoryTest.java
@@ -0,0 +1,34 @@
@ -129,13 +129,13 @@ index 0000000000000000000000000000000000000000..b9824b1f9491304ceb91be18f4f3b306
+import net.minecraft.world.entity.MobType;
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
+import org.bukkit.entity.EntityCategory;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import java.lang.reflect.Field;
+import java.util.Map;
+import java.util.Set;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class EntityCategoryTest {
+
@ -152,6 +152,6 @@ index 0000000000000000000000000000000000000000..b9824b1f9491304ceb91be18f4f3b306
+ for (EntityCategory entityCategory : EntityCategory.values()) {
+ enumMonsterTypeFieldMap.remove(CraftLivingEntity.fromBukkitEntityCategory(entityCategory));
+ }
+ assertTrue(MobType.class.getName() + " instance(s): " + Joiner.on(", ").join(enumMonsterTypeFieldMap.values()) + " do not have bukkit equivalents", enumMonsterTypeFieldMap.size() == 0);
+ assertTrue(enumMonsterTypeFieldMap.size() == 0, MobType.class.getName() + " instance(s): " + Joiner.on(", ").join(enumMonsterTypeFieldMap.values()) + " do not have bukkit equivalents");
+ }
+}

View File

@ -32,7 +32,7 @@ index 5d72d2c6fcab478121eb9b4216cf79532b58299e..88c899e323eb554febe191ac7df678bb
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 76b4c43343fd3ee13662ac7cd6e0e5ae4df0d615..9b266dd16dbf863dcf08783ec665dd237b048793 100644
index 03639ba2ad9c91a96e6fd46f023c101a63b760e8..228f923907fd304893f66cd389208ce5064b8563 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -361,7 +361,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {

View File

@ -72,7 +72,7 @@ index cfaa85dc3d567bf0110e45fc4e4f24a406b41a45..313cd180cbad5727433daae4c15ffa4e
{
diff --git a/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java b/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..9765f08707df27d1a46a1daa1cc2e2fc9cda3ffe
index 0000000000000000000000000000000000000000..69c9678f8218c240be1044eeabe1c6bef7747b1e
--- /dev/null
+++ b/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java
@@ -0,0 +1,24 @@
@ -80,9 +80,9 @@ index 0000000000000000000000000000000000000000..9765f08707df27d1a46a1daa1cc2e2fc
+
+import org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations;
+import org.bukkit.scoreboard.DisplaySlot;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+public class DisplaySlotTest {
+

View File

@ -105,7 +105,7 @@ index b16e22ab5f371ce8d84a77a2f709d3541d48d3b6..b697619abf1bce42a15a38d959dad37d
/**
diff --git a/src/test/java/io/papermc/paper/attribute/EntityTypeAttributesTest.java b/src/test/java/io/papermc/paper/attribute/EntityTypeAttributesTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..7b999deba66aa6d22cd7520f6c13550a44ca327d
index 0000000000000000000000000000000000000000..e8cdfa385230d3de202122e4df5e07f61f80ce75
--- /dev/null
+++ b/src/test/java/io/papermc/paper/attribute/EntityTypeAttributesTest.java
@@ -0,0 +1,39 @@
@ -117,12 +117,12 @@ index 0000000000000000000000000000000000000000..7b999deba66aa6d22cd7520f6c13550a
+import org.bukkit.attribute.AttributeModifier;
+import org.bukkit.entity.EntityType;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class EntityTypeAttributesTest extends AbstractTestingBase {
+

View File

@ -189,7 +189,7 @@ index 313cd180cbad5727433daae4c15ffa4e1e948eaa..8f8b14cb845bf1ba28276b3e3c0d8f8c
{
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..4d043e0e43ef8bb75788e195f95b5a50a51a2a48
index 0000000000000000000000000000000000000000..1a4b930ecf10dac8336dd2eceb4ee2bf9ec780d5
--- /dev/null
+++ b/src/test/java/io/papermc/paper/advancement/AdvancementFrameTest.java
@@ -0,0 +1,24 @@
@ -199,9 +199,9 @@ index 0000000000000000000000000000000000000000..4d043e0e43ef8bb75788e195f95b5a50
+import net.kyori.adventure.text.format.TextColor;
+import net.minecraft.advancements.FrameType;
+import net.minecraft.network.chat.contents.TranslatableContents;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class AdvancementFrameTest {
+
@ -211,8 +211,8 @@ index 0000000000000000000000000000000000000000..4d043e0e43ef8bb75788e195f95b5a50
+ final TextColor expectedColor = PaperAdventure.asAdventure(nmsFrameType.getChatColor());
+ final String expectedTranslationKey = ((TranslatableContents) nmsFrameType.getDisplayName().getContents()).getKey();
+ final var frame = PaperAdvancementDisplay.asPaperFrame(nmsFrameType);
+ assertEquals("The translation keys should be the same", expectedTranslationKey, frame.translationKey());
+ assertEquals("The frame colors should be the same", expectedColor, frame.color());
+ assertEquals(expectedTranslationKey, frame.translationKey(), "The translation keys should be the same");
+ assertEquals(expectedColor, frame.color(), "The frame colors should be the same");
+ assertEquals(nmsFrameType.getName(), AdvancementDisplay.Frame.NAMES.key(frame));
+ }
+ }

View File

@ -315,7 +315,7 @@ index 31b3314bd2e155be8e4f82431dce8b5e3f3934ef..a96a8878c7b1f1e39d07187e8bee8321
}
diff --git a/src/test/java/io/papermc/paper/command/subcommands/MobcapsCommandTest.java b/src/test/java/io/papermc/paper/command/subcommands/MobcapsCommandTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..f1dd3bca7fa0df8b6ed177bb435877229af1c0c5
index 0000000000000000000000000000000000000000..fd238eacee24ebf0d0ce82b96107e093ca4866b0
--- /dev/null
+++ b/src/test/java/io/papermc/paper/command/subcommands/MobcapsCommandTest.java
@@ -0,0 +1,20 @@
@ -324,8 +324,8 @@ index 0000000000000000000000000000000000000000..f1dd3bca7fa0df8b6ed177bb43587722
+import java.util.HashSet;
+import java.util.Set;
+import net.minecraft.world.entity.MobCategory;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class MobcapsCommandTest {
+ @Test
@ -336,6 +336,6 @@ index 0000000000000000000000000000000000000000..f1dd3bca7fa0df8b6ed177bb43587722
+ missing.add(value.getName());
+ }
+ }
+ Assert.assertTrue("MobcapsCommand.MOB_CATEGORY_COLORS map missing TextColors for [" + String.join(", ", missing + "]"), missing.isEmpty());
+ Assertions.assertTrue(missing.isEmpty(), "MobcapsCommand.MOB_CATEGORY_COLORS map missing TextColors for [" + String.join(", ", missing + "]"));
+ }
+}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Use Velocity compression and cipher natives
diff --git a/build.gradle.kts b/build.gradle.kts
index b81b99a7767e3b0d3549e49529e98efdb7334101..7df1b44674ba5e826ad7c96c9d242865a3282307 100644
index ace5cd8aa4fc2a555673b75adb910a1ede3f57fc..98bed6bb990ecb40be0e2b74ad40f84ab0ba3705 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -41,6 +41,11 @@ dependencies {

View File

@ -25,7 +25,7 @@ index 581e0f4d68d6eb8eb04449586ffdba35e8b3ad2b..9a045a7793ec20334853a0e1c3529b31
@Override
diff --git a/src/test/java/io/papermc/paper/inventory/CraftMetaTropicalFishBucketTest.java b/src/test/java/io/papermc/paper/inventory/CraftMetaTropicalFishBucketTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..2e7f8ef88ae74c7cbfdb7f397951cbc8479a995f
index 0000000000000000000000000000000000000000..a71e1d488a74dcac70b1dca889181527395be9b5
--- /dev/null
+++ b/src/test/java/io/papermc/paper/inventory/CraftMetaTropicalFishBucketTest.java
@@ -0,0 +1,40 @@
@ -37,15 +37,15 @@ index 0000000000000000000000000000000000000000..2e7f8ef88ae74c7cbfdb7f397951cbc8
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.TropicalFishBucketMeta;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class CraftMetaTropicalFishBucketTest extends AbstractTestingBase {
+
+ @Test
+ public void testAllCombinations() {
+ final var rawMeta = new ItemStack(Material.TROPICAL_FISH_BUCKET).getItemMeta();
+ Assert.assertTrue("Meta was not a tropical fish bucket", rawMeta instanceof TropicalFishBucketMeta);
+ Assertions.assertTrue(rawMeta instanceof TropicalFishBucketMeta, "Meta was not a tropical fish bucket");
+
+ final var meta = (TropicalFishBucketMeta) rawMeta;
+
@ -53,16 +53,16 @@ index 0000000000000000000000000000000000000000..2e7f8ef88ae74c7cbfdb7f397951cbc8
+ for (final var pattern : TropicalFish.Pattern.values()) {
+ for (final var patternColor : DyeColor.values()) {
+ meta.setBodyColor(bodyColor);
+ Assert.assertEquals("Body color did not match post body color!", bodyColor, meta.getBodyColor());
+ Assertions.assertEquals(bodyColor, meta.getBodyColor(), "Body color did not match post body color!");
+
+ meta.setPattern(pattern);
+ Assert.assertEquals("Pattern did not match post pattern!", pattern, meta.getPattern());
+ Assert.assertEquals("Body color did not match post pattern!", bodyColor, meta.getBodyColor());
+ Assertions.assertEquals(pattern, meta.getPattern(), "Pattern did not match post pattern!");
+ Assertions.assertEquals(bodyColor, meta.getBodyColor(), "Body color did not match post pattern!");
+
+ meta.setPatternColor(patternColor);
+ Assert.assertEquals("Pattern did not match post pattern color!", pattern, meta.getPattern());
+ Assert.assertEquals("Body color did not match post pattern color!", bodyColor, meta.getBodyColor());
+ Assert.assertEquals("Pattern color did not match post pattern color!", patternColor, meta.getPatternColor());
+ Assertions.assertEquals(pattern, meta.getPattern(), "Pattern did not match post pattern color!");
+ Assertions.assertEquals(bodyColor, meta.getBodyColor(), "Body color did not match post pattern color!");
+ Assertions.assertEquals(patternColor, meta.getPatternColor(), "Pattern color did not match post pattern color!");
+ }
+ }
+ }

View File

@ -399,10 +399,10 @@ index 17e1131c79ad140c0803a914621ce7924f0f2a6d..da4609caecc8183d02c301c7cedbca52
return factory.createBlockState(world, blockPosition, blockData, tileEntity);
}
diff --git a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java
index a6dbd1919bce5b5092666372f4cc31d2e2190c42..3cdc3bdba201afb45b7121c0792d585194c90a14 100644
index e31689815b562c8b0644294b00502f7a1dc9911c..cdb05c98836e07548c993b9b8a588e8000190d21 100644
--- a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java
@@ -10,6 +10,7 @@ import net.minecraft.core.registries.BuiltInRegistries;
@@ -7,6 +7,7 @@ import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
@ -410,7 +410,7 @@ index a6dbd1919bce5b5092666372f4cc31d2e2190c42..3cdc3bdba201afb45b7121c0792d5851
import org.bukkit.Material;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.support.AbstractTestingBase;
@@ -45,4 +46,13 @@ public class BlockStateTest extends AbstractTestingBase {
@@ -42,4 +43,13 @@ public class BlockStateTest extends AbstractTestingBase {
}
}
}
@ -419,7 +419,7 @@ index a6dbd1919bce5b5092666372f4cc31d2e2190c42..3cdc3bdba201afb45b7121c0792d5851
+ @Test
+ public void testBlockEntityTypes() {
+ for (var blockEntityType : BuiltInRegistries.BLOCK_ENTITY_TYPE) {
+ org.junit.Assert.assertNotNull(CraftBlockStates.getBlockStateType(blockEntityType));
+ org.junit.jupiter.api.Assertions.assertNotNull(CraftBlockStates.getBlockStateType(blockEntityType));
+ }
+ }
+ // Paper end

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add new overload to PersistentDataContainer#has
Adds the new overload: PersistentDataContainer#has(NamespacedKey key)
diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
index a94389eebe51bb368f759b3f99f0b9ed08ae2bdd..64110e74c6f6f0433219a721b490970ee33c0b00 100644
index 1c33e3456c410dac3ac2f0caef52ee24e00ffca5..564e97c6fefb4c8af4b4df70e68951a2157e72cb 100644
--- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
@@ -161,5 +161,12 @@ public class CraftPersistentDataContainer implements PersistentDataContainer {

View File

@ -62,7 +62,7 @@ index 8f63c21186d8daa290286676bc2478d8629c533b..f05cbb27563fc5287875764b183c485c
}
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..a5012bc0469ba03cde66749a11f4e7d93206bfd7
index 0000000000000000000000000000000000000000..6262598f85bd7d9af5546cc0a96531b2f4baf64d
--- /dev/null
+++ b/src/test/java/io/papermc/paper/effects/EffectCategoryTest.java
@@ -0,0 +1,28 @@
@ -72,17 +72,17 @@ index 0000000000000000000000000000000000000000..a5012bc0469ba03cde66749a11f4e7d9
+import net.minecraft.world.effect.MobEffectCategory;
+import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
+import org.bukkit.potion.PotionEffectType;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+public class EffectCategoryTest {
+
+ @Test
+ public void testEffectCategoriesExist() {
+ for (MobEffectCategory mobEffectInfo : MobEffectCategory.values()) {
+ assertNotNull(mobEffectInfo + " is missing a bukkit equivalent", CraftPotionEffectType.fromNMS(mobEffectInfo));
+ assertNotNull(CraftPotionEffectType.fromNMS(mobEffectInfo), mobEffectInfo + " is missing a bukkit equivalent");
+ }
+ }
+
@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..a5012bc0469ba03cde66749a11f4e7d9
+ public void testCategoryHasEquivalentColors() {
+ for (MobEffectCategory mobEffectInfo : MobEffectCategory.values()) {
+ PotionEffectType.Category bukkitEffectCategory = CraftPotionEffectType.fromNMS(mobEffectInfo);
+ assertEquals(mobEffectInfo.getTooltipFormatting().name() + " doesn't equal " + bukkitEffectCategory.getColor(), bukkitEffectCategory.getColor(), PaperAdventure.asAdventure(mobEffectInfo.getTooltipFormatting()));
+ assertEquals(bukkitEffectCategory.getColor(), PaperAdventure.asAdventure(mobEffectInfo.getTooltipFormatting()), mobEffectInfo.getTooltipFormatting().name() + " doesn't equal " + bukkitEffectCategory.getColor());
+ }
+ }
+}

View File

@ -269,7 +269,7 @@ index 38da4cc3fe3be86e43432de942a1290fa8215474..5b5109e942b18418b3a3a0e2109fe4ef
}
diff --git a/src/test/java/io/papermc/paper/world/structure/StructureSeedConfigTest.java b/src/test/java/io/papermc/paper/world/structure/StructureSeedConfigTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..9bdf311f625402dcc27262b8b93bee9b7e8ba87a
index 0000000000000000000000000000000000000000..eeb03ecaaa81ef21c15460245398e5246c3ac514
--- /dev/null
+++ b/src/test/java/io/papermc/paper/world/structure/StructureSeedConfigTest.java
@@ -0,0 +1,74 @@
@ -288,11 +288,11 @@ index 0000000000000000000000000000000000000000..9bdf311f625402dcc27262b8b93bee9b
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.support.AbstractTestingBase;
+import org.jetbrains.annotations.NotNull;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.spigotmc.SpigotConfig;
+import org.spigotmc.SpigotWorldConfig;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class StructureSeedConfigTest extends AbstractTestingBase {
+
@ -340,10 +340,10 @@ index 0000000000000000000000000000000000000000..9bdf311f625402dcc27262b8b93bee9b
+ final Field field = StructurePlacement.class.getDeclaredField("HIGHLY_ARBITRARY_RANDOM_SALT");
+ field.trySetAccessible();
+ assertEquals(0, set.placement().salt);
+ assertEquals("Mismatched default seed for " + setKey + ". Should be " + field.get(null), field.get(null), salt);
+ assertEquals(field.get(null), salt, "Mismatched default seed for " + setKey + ". Should be " + field.get(null));
+ continue;
+ }
+ assertEquals("Mismatched default seed for " + setKey + ". Should be " + set.placement().salt, set.placement().salt, salt);
+ assertEquals(set.placement().salt, salt, "Mismatched default seed for " + setKey + ". Should be " + set.placement().salt);
+ }
+ }
+}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add support for Proxy Protocol
diff --git a/build.gradle.kts b/build.gradle.kts
index 7df1b44674ba5e826ad7c96c9d242865a3282307..26618ddf85952694ae2c78f41a19e4b9a324f059 100644
index 98bed6bb990ecb40be0e2b74ad40f84ab0ba3705..f1ade7432ae6fae1bceb90f975448ab43543942f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -30,6 +30,7 @@ dependencies {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Added byte array serialization/deserialization for
diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
index 64110e74c6f6f0433219a721b490970ee33c0b00..65013fd2ca24c4bf1cfd67e314927e72542d3e68 100644
index 564e97c6fefb4c8af4b4df70e68951a2157e72cb..8f3769145c3dacc976cc926d896ea9f82332119c 100644
--- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
@@ -168,5 +168,26 @@ public class CraftPersistentDataContainer implements PersistentDataContainer {

View File

@ -41,10 +41,10 @@ index e65bdbbbedb91eca016d46de5cc7cbb70dd9f659..9024467a627a40a145a951510f2207e2
Material.GLOW_ITEM_FRAME,
Material.PAINTING
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
index 7cc7f485325a4277bac7a6eade749dbb3b0b104f..6930e7fdbe1f42020afb9c089c77da60408dacd7 100644
index 937ddd3a2b9e1df2c8835079923c339178f08459..ceca8b6a4a11753bef7ad341c34ccda60114c6b5 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
@@ -235,6 +235,27 @@ public class ItemMetaTest extends AbstractTestingBase {
@@ -236,6 +236,27 @@ public class ItemMetaTest extends AbstractTestingBase {
}
}
@ -59,11 +59,11 @@ index 7cc7f485325a4277bac7a6eade749dbb3b0b104f..6930e7fdbe1f42020afb9c089c77da60
+ for (final Item item : BuiltInRegistries.ITEM) {
+ if (item instanceof net.minecraft.world.item.HangingEntityItem || item instanceof net.minecraft.world.item.MobBucketItem) {
+ ItemStack stack = new ItemStack(CraftMagicNumbers.getMaterial(item));
+ assertTrue("missing entity tag meta handling for " + item, ENTITY_TAG_METAS.contains(stack.getItemMeta().getClass()));
+ assertTrue(ENTITY_TAG_METAS.contains(stack.getItemMeta().getClass()), "missing entity tag meta handling for " + item);
+ stack = CraftItemStack.asNewCraftStack(net.minecraft.world.item.Items.STONE);
+ stack.editMeta(meta -> meta.displayName(net.kyori.adventure.text.Component.text("hello")));
+ stack.setType(CraftMagicNumbers.getMaterial(item));
+ assertTrue("missing entity tag meta handling for " + item, ENTITY_TAG_METAS.contains(stack.getItemMeta().getClass()));
+ assertTrue(ENTITY_TAG_METAS.contains(stack.getItemMeta().getClass()), "missing entity tag meta handling for " + item);
+ }
+ }
+ }

View File

@ -47,7 +47,7 @@ index c92981aedebe934cefa1c96a0328fb91fe17acbc..80138632e5216c71fe7060a59dbb2915
CraftMetaArmor(Map<String, Object> map) {
super(map);
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 9b266dd16dbf863dcf08783ec665dd237b048793..4bfa08fe53604145a7b1c4e7630bf46519223b59 100644
index 228f923907fd304893f66cd389208ce5064b8563..d7fd0ef9251c9d63009f93b2edf42669bd645c02 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -489,7 +489,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {

View File

@ -72,7 +72,7 @@ index d997deef986fd50a23c1fbb10774e4974e0a1cc0..7c73dd0717924531523e126bc79282ae
Preconditions.checkArgument(effect.getData() == null || effect == Effect.ELECTRIC_SPARK, "Wrong kind of data for the %s effect", effect);
diff --git a/src/test/java/org/bukkit/EffectTest.java b/src/test/java/org/bukkit/EffectTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..35e46e3f3747193ddc2f5b8bb7bec1bc955228f3
index 0000000000000000000000000000000000000000..875eacc2e5776901ba8593d0183844db2571f71b
--- /dev/null
+++ b/src/test/java/org/bukkit/EffectTest.java
@@ -0,0 +1,64 @@
@ -85,11 +85,11 @@ index 0000000000000000000000000000000000000000..35e46e3f3747193ddc2f5b8bb7bec1bc
+import java.util.List;
+import java.util.Map;
+import net.minecraft.world.level.block.LevelEvent;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class EffectTest {
+
@ -114,12 +114,12 @@ index 0000000000000000000000000000000000000000..35e46e3f3747193ddc2f5b8bb7bec1bc
+ for (final Effect effect : Effect.values()) {
+ if (isNotDeprecated(effect)) {
+ final Effect put = toId.put(effect.getId(), effect);
+ assertNull("duplicate API effect: " + put, put);
+ assertNull(put, "duplicate API effect: " + put);
+ }
+ }
+
+ for (final Integer event : collectNmsLevelEvents()) {
+ assertNotNull("missing API Effect: " + event, toId.get(event));
+ assertNotNull(toId.get(event), "missing API Effect: " + event);
+ }
+ }
+
@ -130,13 +130,13 @@ index 0000000000000000000000000000000000000000..35e46e3f3747193ddc2f5b8bb7bec1bc
+ for (final Effect effect : Effect.values()) {
+ if (isNotDeprecated(effect)) {
+ final Effect put = toId.put(effect.getId(), effect);
+ assertNull("duplicate API effect: " + put, put);
+ assertNull(put, "duplicate API effect: " + put);
+ }
+ }
+
+ final List<Integer> nmsEvents = collectNmsLevelEvents();
+ for (final Map.Entry<Integer, Effect> entry : toId.entrySet()) {
+ assertTrue("Extra API Effect: " + entry.getValue(), nmsEvents.contains(entry.getKey()));
+ assertTrue(nmsEvents.contains(entry.getKey()), "Extra API Effect: " + entry.getValue());
+ }
+ }
+}

View File

@ -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..934b4b5b0d36e84fed6c2754b513395a22b86eb5
index 0000000000000000000000000000000000000000..b39b12cb6ff3caee5946b1c1b7c510f388d28d19
--- /dev/null
+++ b/src/test/java/io/papermc/paper/world/block/BlockPlayerDestroyOverrideTest.java
@@ -0,0 +1,51 @@
@@ -0,0 +1,48 @@
+package io.papermc.paper.world.block;
+
+import io.github.classgraph.ClassGraph;
@ -122,21 +122,17 @@ index 0000000000000000000000000000000000000000..934b4b5b0d36e84fed6c2754b513395a
+import io.github.classgraph.ScanResult;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@RunWith(Parameterized.class)
+public class BlockPlayerDestroyOverrideTest extends AbstractTestingBase {
+
+ @Parameterized.Parameter
+ public ClassInfo overridesPlayerDestroy;
+
+ @Parameterized.Parameters
+ public static Iterable<ClassInfo> parameters() {
+ @MethodSource("parameters")
+ public static Stream<ClassInfo> parameters() {
+ final List<ClassInfo> classInfo = new ArrayList<>();
+ try (ScanResult scanResult = new ClassGraph()
+ .enableClassInfo()
@ -151,15 +147,16 @@ index 0000000000000000000000000000000000000000..934b4b5b0d36e84fed6c2754b513395a
+ }
+ }
+ }
+ return classInfo;
+ return classInfo.stream();
+ }
+
+ @Test
+ public void checkPlayerDestroyOverrides() {
+ final MethodInfoList playerDestroy = this.overridesPlayerDestroy.getDeclaredMethodInfo("playerDestroy");
+ assertEquals(this.overridesPlayerDestroy.getName() + " has multiple playerDestroy methods", 1, playerDestroy.size());
+ @ParameterizedTest
+ @MethodSource("parameters")
+ public void checkPlayerDestroyOverrides(ClassInfo overridesPlayerDestroy) {
+ final MethodInfoList playerDestroy = overridesPlayerDestroy.getDeclaredMethodInfo("playerDestroy");
+ assertEquals(1, playerDestroy.size(), overridesPlayerDestroy.getName() + " has multiple playerDestroy methods");
+ final MethodInfo next = playerDestroy.iterator().next();
+ final MethodParameterInfo[] parameterInfo = next.getParameterInfo();
+ assertEquals(this.overridesPlayerDestroy.getName() + " needs to change it's override of playerDestroy", "boolean", parameterInfo[parameterInfo.length - 1].getTypeDescriptor().toStringWithSimpleNames());
+ assertEquals(overridesPlayerDestroy.getName() + " needs to change its override of playerDestroy", "boolean", parameterInfo[parameterInfo.length - 1].getTypeDescriptor().toStringWithSimpleNames());
+ }
+}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Deep clone unhandled nbt tags
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 4bfa08fe53604145a7b1c4e7630bf46519223b59..9d4cb06b8009c6e22db4237cffa99008bbec6e84 100644
index d7fd0ef9251c9d63009f93b2edf42669bd645c02..aeca803cc0434d9de9434987d6e43b70353e305b 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -304,7 +304,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@ -44,7 +44,7 @@ index 4bfa08fe53604145a7b1c4e7630bf46519223b59..9d4cb06b8009c6e22db4237cffa99008
clone.unbreakable = this.unbreakable;
clone.damage = this.damage;
diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
index 65013fd2ca24c4bf1cfd67e314927e72542d3e68..b040bd8be5c1803d0b4045990489ae4182f69568 100644
index 8f3769145c3dacc976cc926d896ea9f82332119c..91cb4a28afa5d83e6de10dab834ed63e2eb3b76f 100644
--- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
@@ -189,5 +189,11 @@ public class CraftPersistentDataContainer implements PersistentDataContainer {

View File

@ -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..4845f24e291ed8d643e182f3d6c50746a6ca2ded
index 0000000000000000000000000000000000000000..7b40accf09e4accc80e7e4367035765212c70056
--- /dev/null
+++ b/src/test/java/io/papermc/paper/entity/EntitySetItemSlotSilentOverrideTest.java
@@ -0,0 +1,55 @@
@@ -0,0 +1,52 @@
+package io.papermc.paper.entity;
+
+import io.github.classgraph.ClassGraph;
@ -78,21 +78,17 @@ index 0000000000000000000000000000000000000000..4845f24e291ed8d643e182f3d6c50746
+import io.github.classgraph.ScanResult;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
+
+@RunWith(Parameterized.class)
+public class EntitySetItemSlotSilentOverrideTest extends AbstractTestingBase {
+
+ @Parameterized.Parameter
+ public ClassInfo overridesSetItemSlot;
+
+ @Parameterized.Parameters(name = "{0}")
+ public static Iterable<ClassInfo> parameters() {
+ @MethodSource("parameters")
+ public static Stream<ClassInfo> parameters() {
+ final List<ClassInfo> classInfo = new ArrayList<>();
+ try (ScanResult scanResult = new ClassGraph()
+ .enableClassInfo()
@ -107,12 +103,13 @@ index 0000000000000000000000000000000000000000..4845f24e291ed8d643e182f3d6c50746
+ }
+ }
+ }
+ return classInfo;
+ return classInfo.stream();
+ }
+
+ @Test
+ public void checkSetItemSlotSilentOverrides() {
+ final MethodInfoList setItemSlot = this.overridesSetItemSlot.getDeclaredMethodInfo("setItemSlot");
+ @ParameterizedTest
+ @MethodSource("parameters")
+ public void checkSetItemSlotSilentOverrides(ClassInfo overridesSetItemSlot) {
+ final MethodInfoList setItemSlot = overridesSetItemSlot.getDeclaredMethodInfo("setItemSlot");
+ for (final MethodInfo methodInfo : setItemSlot) {
+ for (final MethodParameterInfo methodParameterInfo : methodInfo.getParameterInfo()) {
+ if ("boolean".equals(methodParameterInfo.getTypeDescriptor().toStringWithSimpleNames())) {
@ -120,6 +117,6 @@ index 0000000000000000000000000000000000000000..4845f24e291ed8d643e182f3d6c50746
+ }
+ }
+ }
+ fail(this.overridesSetItemSlot.getName() + " needs to override setItemSlot with the boolean silent parameter as well");
+ fail(overridesSetItemSlot.getName() + " needs to override setItemSlot with the boolean silent parameter as well");
+ }
+}

@ -1 +1 @@
Subproject commit dfe1fb4853158bd17f6955527ad3bf85f4d5150d
Subproject commit fb23cbb3829ef866094f45ffc5391d516e6a3c57

@ -1 +1 @@
Subproject commit f71a799f03aae4277a48b4a1082b478833975682
Subproject commit f0661c3514a7d8e51e2281f045e1c14d0e733230