mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 08:17:44 +01:00
Updated Upstream (Bukkit/CraftBukkit) (#11501)
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: bb4e97c6 Add support for Java 23 bc6874dd Bump asm to 9.7.1 50e8a00b PR-1064: Add specific getTopInventory methods for InventoryView derivatives 758b0a0f SPIGOT-7911: Fix Location#isWorldLoaded() for re-loaded worlds 133a64a7 Improve Registry#getOrThrow messages be0f5957 PR-1058: Add tests for Minecraft registry <-> Bukkit fields d1b31df2 PR-1062: Clarify BeaconView documentation 3fab4384 PR-1060: Cache Material to BlockType and ItemType conversion 967a7301 SPIGOT-7906: Increase YAML nesting limit to 100 6ecf033d SPIGOT-7899: Smithing recipes don't require inputs CraftBukkit Changes: 0a7bd6c81 PR-1493: Improve reroute performance and add some tests 54941524c Add support for Java 23 f4d957fff SPIGOT-7915: Fix World#getKeepSpawnInMemory() using Spawn Radius rather than Spawn Chunk Radius ded183674 Fix HIDE_ENCHANTS flag in items without enchantments 308785a0a Bump asm to 9.7.1 and re-add ClassReader to ClassWriter 72ce823cd PR-1487: Add specific getTopInventory methods for InventoryView derivatives 11a5e840c SPIGOT-7907, PR-1484: Improve merchant recipe item matching behavior to more closely align with older versions 45b66f7e4 SPIGOT-7909: Always set HIDE_ENCHANTS flag to item if flag is set 963459791 Increase outdated build delay fc5b2d75f SPIGOT-7910: Fix launching breeze wind charge from API and improve dispenser launch API c7d6428f2 SPIGOT-7856, PR-1483: End platform not dropping items after replacing blocks 2a5572b52 SPIGOT-7780, PR-1482: Cannot edit chunks during unload event 527041ab5 SPIGOT-7902, PR-1477: Fix CraftMetaPotion#hasCustomEffects() does not check if customEffects (List) is empty 5529a1769 Implement base methods for tags 30fbdbaaf Improve Registry#getOrThrow messages 6b71a7322 PR-1475: Add tests for Minecraft registry <-> Bukkit fields 5f24c255c SPIGOT-7908: Mark junit-platform-suite-engine as test scope e4c92ef65 PR-1473: Change tests to use suites, to run tests in different environments and feature flags d25e1e722 PR-1481: Fix BeaconView#set[X]Effect(null) d69a05362 PR-1480: Fix PerMaterialTest#isEdible test running for legacy materials bb3284a89 PR-1479: Use custom #isBlock method in legacy init instead of the one in Material, since it relies on legacy being init 98c57cbbe SPIGOT-7904: Fix NPE for PlayerItemBreakEvent f35bae9ec Fix missing hasJukeboxPlayable 8a6f8b6d8 SPIGOT-7881: CTRL+Pick Block saves position data into item 7913b3be7 SPIGOT-7899: Smithing recipes don't require inputs
This commit is contained in:
parent
64705c224b
commit
7c5395237d
@ -289,7 +289,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
* @see Structure
|
* @see Structure
|
||||||
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#STRUCTURE}
|
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#STRUCTURE}
|
||||||
*/
|
*/
|
||||||
- Registry<Structure> STRUCTURE = Bukkit.getRegistry(Structure.class);
|
- Registry<Structure> STRUCTURE = Objects.requireNonNull(Bukkit.getRegistry(Structure.class), "No registry present for Structure. This is a bug.");
|
||||||
+ @Deprecated(since = "1.20.6") // Paper
|
+ @Deprecated(since = "1.20.6") // Paper
|
||||||
+ Registry<Structure> STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Structure.class), "No registry present for Structure. This is a bug."); // Paper
|
+ Registry<Structure> STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Structure.class), "No registry present for Structure. This is a bug."); // Paper
|
||||||
/**
|
/**
|
||||||
@ -297,8 +297,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
*
|
*
|
||||||
* @see StructureType
|
* @see StructureType
|
||||||
*/
|
*/
|
||||||
- Registry<StructureType> STRUCTURE_TYPE = Bukkit.getRegistry(StructureType.class);
|
- Registry<StructureType> STRUCTURE_TYPE = Objects.requireNonNull(Bukkit.getRegistry(StructureType.class), "No registry present for StructureType. This is a bug.");
|
||||||
+ Registry<StructureType> STRUCTURE_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.STRUCTURE_TYPE); // Paper
|
+ Registry<StructureType> STRUCTURE_TYPE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.STRUCTURE_TYPE), "No registry present for StructureType. This is a bug."); // Paper
|
||||||
/**
|
/**
|
||||||
* Sound keys.
|
* Sound keys.
|
||||||
*
|
*
|
||||||
@ -308,7 +308,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
* @see TrimMaterial
|
* @see TrimMaterial
|
||||||
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#TRIM_MATERIAL}
|
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#TRIM_MATERIAL}
|
||||||
*/
|
*/
|
||||||
- Registry<TrimMaterial> TRIM_MATERIAL = Bukkit.getRegistry(TrimMaterial.class);
|
- Registry<TrimMaterial> TRIM_MATERIAL = Objects.requireNonNull(Bukkit.getRegistry(TrimMaterial.class), "No registry present for TrimMaterial. This is a bug.");
|
||||||
+ @Deprecated(since = "1.20.6") // Paper
|
+ @Deprecated(since = "1.20.6") // Paper
|
||||||
+ Registry<TrimMaterial> TRIM_MATERIAL = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimMaterial.class), "No registry present for TrimMaterial. This is a bug."); // Paper
|
+ Registry<TrimMaterial> TRIM_MATERIAL = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimMaterial.class), "No registry present for TrimMaterial. This is a bug."); // Paper
|
||||||
/**
|
/**
|
||||||
@ -317,7 +317,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
* @see TrimPattern
|
* @see TrimPattern
|
||||||
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#TRIM_PATTERN}
|
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#TRIM_PATTERN}
|
||||||
*/
|
*/
|
||||||
- Registry<TrimPattern> TRIM_PATTERN = Bukkit.getRegistry(TrimPattern.class);
|
- Registry<TrimPattern> TRIM_PATTERN = Objects.requireNonNull(Bukkit.getRegistry(TrimPattern.class), "No registry present for TrimPattern. This is a bug.");
|
||||||
+ @Deprecated(since = "1.20.6")
|
+ @Deprecated(since = "1.20.6")
|
||||||
+ Registry<TrimPattern> TRIM_PATTERN = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimPattern.class), "No registry present for TrimPattern. This is a bug."); // Paper
|
+ Registry<TrimPattern> TRIM_PATTERN = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimPattern.class), "No registry present for TrimPattern. This is a bug."); // Paper
|
||||||
/**
|
/**
|
||||||
@ -460,6 +460,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
-
|
-
|
||||||
- @NotNull
|
- @NotNull
|
||||||
- @Override
|
- @Override
|
||||||
|
- public Keyed getOrThrow(@NotNull NamespacedKey key) {
|
||||||
|
- Keyed keyed = get(key);
|
||||||
|
-
|
||||||
|
- Preconditions.checkArgument(keyed != null, "No %s registry entry found for key %s.", aClass, key);
|
||||||
|
-
|
||||||
|
- return keyed;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @NotNull
|
||||||
|
- @Override
|
||||||
- public Stream<Keyed> stream() {
|
- public Stream<Keyed> stream() {
|
||||||
- throw new UnsupportedOperationException("Not supported");
|
- throw new UnsupportedOperationException("Not supported");
|
||||||
- }
|
- }
|
||||||
|
@ -200,8 +200,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public static final MusicInstrument PONDER_GOAT_HORN = getInstrument("ponder_goat_horn");
|
public static final MusicInstrument PONDER_GOAT_HORN = getInstrument("ponder_goat_horn");
|
||||||
public static final MusicInstrument SING_GOAT_HORN = getInstrument("sing_goat_horn");
|
public static final MusicInstrument SING_GOAT_HORN = getInstrument("sing_goat_horn");
|
||||||
@@ -0,0 +0,0 @@ public abstract class MusicInstrument implements Keyed {
|
@@ -0,0 +0,0 @@ public abstract class MusicInstrument implements Keyed {
|
||||||
|
private static MusicInstrument getInstrument(@NotNull String key) {
|
||||||
return instrument;
|
return Registry.INSTRUMENT.getOrThrow(NamespacedKey.minecraft(key));
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Paper start - translation key
|
+ // Paper start - translation key
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
|
|
||||||
Date: Fri, 3 May 2024 22:56:12 +0200
|
|
||||||
Subject: [PATCH] Add missing wind charge damage type
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/damage/DamageType.java b/src/main/java/org/bukkit/damage/DamageType.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/org/bukkit/damage/DamageType.java
|
|
||||||
+++ b/src/main/java/org/bukkit/damage/DamageType.java
|
|
||||||
@@ -0,0 +0,0 @@ public interface DamageType extends Keyed, Translatable {
|
|
||||||
public static final DamageType BAD_RESPAWN_POINT = getDamageType("bad_respawn_point");
|
|
||||||
public static final DamageType OUTSIDE_BORDER = getDamageType("outside_border");
|
|
||||||
public static final DamageType GENERIC_KILL = getDamageType("generic_kill");
|
|
||||||
+ DamageType WIND_CHARGE = getDamageType("wind_charge"); // Paper
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private static DamageType getDamageType(@NotNull String key) {
|
|
@ -1012,8 +1012,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/JukeboxSong.java
|
--- a/src/main/java/org/bukkit/JukeboxSong.java
|
||||||
+++ b/src/main/java/org/bukkit/JukeboxSong.java
|
+++ b/src/main/java/org/bukkit/JukeboxSong.java
|
||||||
@@ -0,0 +0,0 @@ public interface JukeboxSong extends Keyed, Translatable {
|
@@ -0,0 +0,0 @@ public interface JukeboxSong extends Keyed, Translatable {
|
||||||
private static JukeboxSong get(@NotNull String s) {
|
private static JukeboxSong get(@NotNull String key) {
|
||||||
return Objects.requireNonNull(Registry.JUKEBOX_SONG.get(NamespacedKey.minecraft(s)), "Missing song " + s);
|
return Registry.JUKEBOX_SONG.getOrThrow(NamespacedKey.minecraft(key));
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Paper start - adventure
|
+ // Paper start - adventure
|
||||||
@ -4882,9 +4882,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java
|
--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java
|
||||||
+++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java
|
+++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java
|
||||||
@@ -0,0 +0,0 @@ public interface TrimMaterial extends Keyed, Translatable {
|
@@ -0,0 +0,0 @@ public interface TrimMaterial extends Keyed, Translatable {
|
||||||
* {@link Material#AMETHYST_SHARD}.
|
private static TrimMaterial getTrimMaterial(@NotNull String key) {
|
||||||
*/
|
return Registry.TRIM_MATERIAL.getOrThrow(NamespacedKey.minecraft(key));
|
||||||
public static final TrimMaterial AMETHYST = Registry.TRIM_MATERIAL.get(NamespacedKey.minecraft("amethyst"));
|
}
|
||||||
+
|
+
|
||||||
+ // Paper start - adventure
|
+ // Paper start - adventure
|
||||||
+ /**
|
+ /**
|
||||||
@ -4908,9 +4908,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java
|
--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java
|
||||||
+++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java
|
+++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java
|
||||||
@@ -0,0 +0,0 @@ public interface TrimPattern extends Keyed, Translatable {
|
@@ -0,0 +0,0 @@ public interface TrimPattern extends Keyed, Translatable {
|
||||||
* {@link Material#BOLT_ARMOR_TRIM_SMITHING_TEMPLATE}.
|
private static TrimPattern getTrimPattern(@NotNull String key) {
|
||||||
*/
|
return Registry.TRIM_PATTERN.getOrThrow(NamespacedKey.minecraft(key));
|
||||||
public static final TrimPattern BOLT = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("bolt"));
|
}
|
||||||
+
|
+
|
||||||
+ // Paper start - adventure
|
+ // Paper start - adventure
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -33,8 +33,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ api("org.apache.logging.log4j:log4j-api:$log4jVersion")
|
+ api("org.apache.logging.log4j:log4j-api:$log4jVersion")
|
||||||
+ api("org.slf4j:slf4j-api:$slf4jVersion")
|
+ api("org.slf4j:slf4j-api:$slf4jVersion")
|
||||||
|
|
||||||
implementation("org.ow2.asm:asm:9.7")
|
implementation("org.ow2.asm:asm:9.7.1")
|
||||||
implementation("org.ow2.asm:asm-commons:9.7")
|
implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||||
@@ -0,0 +0,0 @@ tasks.withType<Javadoc> {
|
@@ -0,0 +0,0 @@ tasks.withType<Javadoc> {
|
||||||
"https://jd.advntr.dev/text-serializer-legacy/$adventureVersion/",
|
"https://jd.advntr.dev/text-serializer-legacy/$adventureVersion/",
|
||||||
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
|
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
|
||||||
|
@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
java {
|
java {
|
||||||
@@ -0,0 +0,0 @@ dependencies {
|
@@ -0,0 +0,0 @@ dependencies {
|
||||||
testImplementation("org.ow2.asm:asm-tree:9.7")
|
testImplementation("org.ow2.asm:asm-tree:9.7.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
+// Paper start
|
+// Paper start
|
||||||
|
@ -63,8 +63,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ testImplementation("org.apache.commons:commons-lang3:3.12.0")
|
+ testImplementation("org.apache.commons:commons-lang3:3.12.0")
|
||||||
+ testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
+ testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||||
+ testImplementation("org.hamcrest:hamcrest:2.2")
|
+ testImplementation("org.hamcrest:hamcrest:2.2")
|
||||||
+ testImplementation("org.mockito:mockito-core:5.11.0")
|
+ testImplementation("org.mockito:mockito-core:5.14.1")
|
||||||
+ testImplementation("org.ow2.asm:asm-tree:9.7")
|
+ testImplementation("org.ow2.asm:asm-tree:9.7.1")
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+configure<PublishingExtension> {
|
+configure<PublishingExtension> {
|
||||||
@ -236,13 +236,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- <dependency>
|
- <dependency>
|
||||||
- <groupId>org.mockito</groupId>
|
- <groupId>org.mockito</groupId>
|
||||||
- <artifactId>mockito-core</artifactId>
|
- <artifactId>mockito-core</artifactId>
|
||||||
- <version>5.11.0</version>
|
- <version>5.14.1</version>
|
||||||
- <scope>test</scope>
|
- <scope>test</scope>
|
||||||
- </dependency>
|
- </dependency>
|
||||||
- <dependency>
|
- <dependency>
|
||||||
- <groupId>org.ow2.asm</groupId>
|
- <groupId>org.ow2.asm</groupId>
|
||||||
- <artifactId>asm-tree</artifactId>
|
- <artifactId>asm-tree</artifactId>
|
||||||
- <version>9.7</version>
|
- <version>9.7.1</version>
|
||||||
- <scope>test</scope>
|
- <scope>test</scope>
|
||||||
- </dependency>
|
- </dependency>
|
||||||
- </dependencies>
|
- </dependencies>
|
||||||
|
@ -461,14 +461,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
* @see TrimMaterial
|
* @see TrimMaterial
|
||||||
*/
|
*/
|
||||||
- @ApiStatus.Experimental
|
- @ApiStatus.Experimental
|
||||||
Registry<TrimMaterial> TRIM_MATERIAL = Bukkit.getRegistry(TrimMaterial.class);
|
Registry<TrimMaterial> TRIM_MATERIAL = Objects.requireNonNull(Bukkit.getRegistry(TrimMaterial.class), "No registry present for TrimMaterial. This is a bug.");
|
||||||
/**
|
/**
|
||||||
* Trim patterns.
|
* Trim patterns.
|
||||||
*
|
*
|
||||||
* @see TrimPattern
|
* @see TrimPattern
|
||||||
*/
|
*/
|
||||||
- @ApiStatus.Experimental
|
- @ApiStatus.Experimental
|
||||||
Registry<TrimPattern> TRIM_PATTERN = Bukkit.getRegistry(TrimPattern.class);
|
Registry<TrimPattern> TRIM_PATTERN = Objects.requireNonNull(Bukkit.getRegistry(TrimPattern.class), "No registry present for TrimPattern. This is a bug.");
|
||||||
/**
|
/**
|
||||||
* Damage types.
|
* Damage types.
|
||||||
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
|
@ -281,7 +281,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class SmithingRecipe implements Recipe, Keyed {
|
@@ -0,0 +0,0 @@ public class SmithingRecipe implements Recipe, Keyed {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) {
|
public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @Nullable RecipeChoice base, @Nullable RecipeChoice addition, boolean copyDataComponents) {
|
||||||
+ com.google.common.base.Preconditions.checkArgument(!result.isEmpty() || this instanceof ComplexRecipe, "Recipe cannot have an empty result."); // Paper
|
+ com.google.common.base.Preconditions.checkArgument(!result.isEmpty() || this instanceof ComplexRecipe, "Recipe cannot have an empty result."); // Paper
|
||||||
this.copyDataComponents = copyDataComponents;
|
this.copyDataComponents = copyDataComponents;
|
||||||
// Paper end
|
// Paper end
|
||||||
@ -289,11 +289,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.result = result;
|
this.result = result;
|
||||||
- this.base = base;
|
- this.base = base;
|
||||||
- this.addition = addition;
|
- this.addition = addition;
|
||||||
+ this.base = base.validate(true).clone(); // Paper
|
+ this.base = base == null ? RecipeChoice.empty() : base.validate(true).clone(); // Paper
|
||||||
+ this.addition = addition.validate(true).clone(); // Paper
|
+ this.addition = addition == null ? RecipeChoice.empty() : addition.validate(true).clone(); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -0,0 +0,0 @@ public class SmithingRecipe implements Recipe, Keyed {
|
||||||
|
*
|
||||||
|
* @return base choice
|
||||||
|
*/
|
||||||
|
- @Nullable
|
||||||
|
+ @NotNull // Paper - fix issues with recipe api
|
||||||
|
public RecipeChoice getBase() {
|
||||||
|
return (base != null) ? base.clone() : null;
|
||||||
|
}
|
||||||
|
@@ -0,0 +0,0 @@ public class SmithingRecipe implements Recipe, Keyed {
|
||||||
|
*
|
||||||
|
* @return addition choice
|
||||||
|
*/
|
||||||
|
- @Nullable
|
||||||
|
+ @NotNull // Paper - fix issues with recipe api
|
||||||
|
public RecipeChoice getAddition() {
|
||||||
|
return (addition != null) ? addition.clone() : null;
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java b/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java
|
diff --git a/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java b/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java
|
--- a/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java
|
||||||
@ -309,10 +327,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ * @param base The base ingredient ({@link RecipeChoice#empty()} can be used)
|
+ * @param base The base ingredient ({@link RecipeChoice#empty()} can be used)
|
||||||
+ * @param addition The addition ingredient ({@link RecipeChoice#empty()} can be used)
|
+ * @param addition The addition ingredient ({@link RecipeChoice#empty()} can be used)
|
||||||
*/
|
*/
|
||||||
public SmithingTransformRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition) {
|
- public SmithingTransformRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @Nullable RecipeChoice template, @Nullable RecipeChoice base, @Nullable RecipeChoice addition) {
|
||||||
|
+ public SmithingTransformRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition) { // Paper - fix issues with recipe api - prevent null choices
|
||||||
super(key, result, base, addition);
|
super(key, result, base, addition);
|
||||||
- this.template = template;
|
- this.template = template;
|
||||||
+ this.template = template.validate(true).clone(); // Paper
|
+ this.template = template == null ? RecipeChoice.empty() : template.validate(true).clone(); // Paper - fix issues with recipe api - prevent null choices
|
||||||
}
|
}
|
||||||
// Paper start
|
// Paper start
|
||||||
/**
|
/**
|
||||||
@ -328,13 +347,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ * @param addition The addition ingredient ({@link RecipeChoice#empty()} can be used)
|
+ * @param addition The addition ingredient ({@link RecipeChoice#empty()} can be used)
|
||||||
* @param copyDataComponents whether to copy the data components from the input base item to the output
|
* @param copyDataComponents whether to copy the data components from the input base item to the output
|
||||||
*/
|
*/
|
||||||
public SmithingTransformRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) {
|
- public SmithingTransformRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @Nullable RecipeChoice template, @Nullable RecipeChoice base, @Nullable RecipeChoice addition, boolean copyDataComponents) {
|
||||||
|
+ public SmithingTransformRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) {
|
||||||
super(key, result, base, addition, copyDataComponents);
|
super(key, result, base, addition, copyDataComponents);
|
||||||
- this.template = template;
|
- this.template = template;
|
||||||
+ this.template = template.validate(true).clone();
|
+ this.template = template == null ? RecipeChoice.empty() : template.validate(true).clone(); // Paper - fix issues with recipe api - prevent null choices
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
|
@@ -0,0 +0,0 @@ public class SmithingTransformRecipe extends SmithingRecipe {
|
||||||
|
*
|
||||||
|
* @return template choice
|
||||||
|
*/
|
||||||
|
- @Nullable
|
||||||
|
+ @NotNull // Paper - fix issues with recipe api - prevent null choices
|
||||||
|
public RecipeChoice getTemplate() {
|
||||||
|
return (template != null) ? template.clone() : null;
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java b/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java
|
diff --git a/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java b/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java
|
--- a/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java
|
||||||
@ -350,10 +379,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ * @param base The base ingredient ({@link RecipeChoice#empty()} can be used)
|
+ * @param base The base ingredient ({@link RecipeChoice#empty()} can be used)
|
||||||
+ * @param addition The addition ingredient ({@link RecipeChoice#empty()} can be used)
|
+ * @param addition The addition ingredient ({@link RecipeChoice#empty()} can be used)
|
||||||
*/
|
*/
|
||||||
public SmithingTrimRecipe(@NotNull NamespacedKey key, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition) {
|
- public SmithingTrimRecipe(@NotNull NamespacedKey key, @Nullable RecipeChoice template, @Nullable RecipeChoice base, @Nullable RecipeChoice addition) {
|
||||||
|
+ public SmithingTrimRecipe(@NotNull NamespacedKey key, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition) { // Paper - fix issues with recipe api - prevent null choices
|
||||||
super(key, new ItemStack(Material.AIR), base, addition);
|
super(key, new ItemStack(Material.AIR), base, addition);
|
||||||
- this.template = template;
|
- this.template = template;
|
||||||
+ this.template = template.validate(true).clone(); // Paper
|
+ this.template = template == null ? RecipeChoice.empty() : template.validate(true).clone(); // Paper
|
||||||
}
|
}
|
||||||
// Paper start
|
// Paper start
|
||||||
/**
|
/**
|
||||||
@ -368,13 +398,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ * @param addition The addition ingredient ({@link RecipeChoice#empty()} can be used)
|
+ * @param addition The addition ingredient ({@link RecipeChoice#empty()} can be used)
|
||||||
* @param copyDataComponents whether to copy the data components from the input base item to the output
|
* @param copyDataComponents whether to copy the data components from the input base item to the output
|
||||||
*/
|
*/
|
||||||
public SmithingTrimRecipe(@NotNull NamespacedKey key, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) {
|
- public SmithingTrimRecipe(@NotNull NamespacedKey key, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) {
|
||||||
|
+ public SmithingTrimRecipe(@NotNull NamespacedKey key, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) { // Paper - fix issues with recipe api - prevent null choices
|
||||||
super(key, new ItemStack(Material.AIR), base, addition, copyDataComponents);
|
super(key, new ItemStack(Material.AIR), base, addition, copyDataComponents);
|
||||||
- this.template = template;
|
- this.template = template;
|
||||||
+ this.template = template.validate(true).clone(); // Paper
|
+ this.template = template == null ? RecipeChoice.empty() : template.validate(true).clone(); // Paper
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
|
@@ -0,0 +0,0 @@ public class SmithingTrimRecipe extends SmithingRecipe implements ComplexRecipe
|
||||||
|
*
|
||||||
|
* @return template choice
|
||||||
|
*/
|
||||||
|
- @Nullable
|
||||||
|
+ @NotNull // Paper - fix issues with recipe api - prevent null choices
|
||||||
|
public RecipeChoice getTemplate() {
|
||||||
|
return (template != null) ? template.clone() : null;
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java b/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java
|
diff --git a/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java b/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java
|
--- a/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java
|
||||||
|
@ -19,27 +19,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.flicker = flicker;
|
this.flicker = flicker;
|
||||||
this.trail = trail;
|
this.trail = trail;
|
||||||
this.colors = colors;
|
this.colors = colors;
|
||||||
diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/org/bukkit/inventory/ItemType.java
|
|
||||||
+++ b/src/main/java/org/bukkit/inventory/ItemType.java
|
|
||||||
@@ -0,0 +0,0 @@ import org.bukkit.inventory.meta.MapMeta;
|
|
||||||
import org.bukkit.inventory.meta.MusicInstrumentMeta;
|
|
||||||
import org.bukkit.inventory.meta.OminousBottleMeta;
|
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
|
||||||
+import org.bukkit.inventory.meta.ShieldMeta;
|
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
|
||||||
import org.bukkit.inventory.meta.SpawnEggMeta;
|
|
||||||
import org.bukkit.inventory.meta.SuspiciousStewMeta;
|
|
||||||
@@ -0,0 +0,0 @@ public interface ItemType extends Keyed, Translatable, net.kyori.adventure.trans
|
|
||||||
/**
|
|
||||||
* ItemMeta: {@link BlockStateMeta}
|
|
||||||
*/
|
|
||||||
- ItemType.Typed<BlockStateMeta> SHIELD = getItemType("shield");
|
|
||||||
+ ItemType.Typed<ShieldMeta> SHIELD = getItemType("shield"); // Paper - update shield to its new meta
|
|
||||||
ItemType.Typed<ItemMeta> TOTEM_OF_UNDYING = getItemType("totem_of_undying");
|
|
||||||
ItemType.Typed<ItemMeta> SHULKER_SHELL = getItemType("shulker_shell");
|
|
||||||
ItemType.Typed<ItemMeta> IRON_NUGGET = getItemType("iron_nugget");
|
|
||||||
diff --git a/src/main/java/org/bukkit/inventory/meta/CompassMeta.java b/src/main/java/org/bukkit/inventory/meta/CompassMeta.java
|
diff --git a/src/main/java/org/bukkit/inventory/meta/CompassMeta.java b/src/main/java/org/bukkit/inventory/meta/CompassMeta.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/inventory/meta/CompassMeta.java
|
--- a/src/main/java/org/bukkit/inventory/meta/CompassMeta.java
|
||||||
|
@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/MusicInstrument.java
|
--- a/src/main/java/org/bukkit/MusicInstrument.java
|
||||||
+++ b/src/main/java/org/bukkit/MusicInstrument.java
|
+++ b/src/main/java/org/bukkit/MusicInstrument.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran
|
@@ -0,0 +0,0 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran
|
||||||
return instrument;
|
return Registry.INSTRUMENT.getOrThrow(NamespacedKey.minecraft(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - deprecate getKey
|
+ // Paper start - deprecate getKey
|
||||||
@ -130,7 +130,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper end - improve Registry
|
+ // Paper end - improve Registry
|
||||||
+
|
+
|
||||||
/**
|
/**
|
||||||
* Returns a new stream, which contains all registry items, which are registered to the registry.
|
* Get the object by its key.
|
||||||
*
|
*
|
||||||
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
public Class<T> getType() {
|
public Class<T> getType() {
|
||||||
|
@ -464,8 +464,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/GameEvent.java
|
--- a/src/main/java/org/bukkit/GameEvent.java
|
||||||
+++ b/src/main/java/org/bukkit/GameEvent.java
|
+++ b/src/main/java/org/bukkit/GameEvent.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class GameEvent implements Keyed {
|
@@ -0,0 +0,0 @@ public abstract class GameEvent implements Keyed {
|
||||||
|
private static GameEvent getEvent(@NotNull String key) {
|
||||||
return gameEvent;
|
return Registry.GAME_EVENT.getOrThrow(NamespacedKey.minecraft(key));
|
||||||
}
|
}
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
//<editor-fold desc="Materials" defaultstate="collapsed">
|
//<editor-fold desc="Materials" defaultstate="collapsed">
|
||||||
AIR(9648, 0),
|
AIR(9648, 0),
|
||||||
@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable {
|
@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable {
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
|
@ -19,25 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ *
|
+ *
|
||||||
+ * @see org.bukkit.potion.PotionEffectType
|
+ * @see org.bukkit.potion.PotionEffectType
|
||||||
+ */
|
+ */
|
||||||
+ Registry<org.bukkit.potion.PotionEffectType> POTION_EFFECT_TYPE = new Registry<org.bukkit.potion.PotionEffectType>() {
|
+ Registry<org.bukkit.potion.PotionEffectType> POTION_EFFECT_TYPE = EFFECT;
|
||||||
+
|
|
||||||
+ @Nullable
|
|
||||||
+ @Override
|
|
||||||
+ public org.bukkit.potion.PotionEffectType get(@NotNull NamespacedKey key) {
|
|
||||||
+ return org.bukkit.potion.PotionEffectType.getByKey(key);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @NotNull
|
|
||||||
+ @Override
|
|
||||||
+ public Iterator<org.bukkit.potion.PotionEffectType> iterator() {
|
|
||||||
+ return java.util.Arrays.stream(org.bukkit.potion.PotionEffectType.values()).iterator();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public @NotNull Stream<org.bukkit.potion.PotionEffectType> stream() {
|
|
||||||
+ return StreamSupport.stream(this.spliterator(), false);
|
|
||||||
+ }
|
|
||||||
+ };
|
|
||||||
+ // Paper end - potion effect type registry
|
+ // Paper end - potion effect type registry
|
||||||
/**
|
/**
|
||||||
* Get the object by its key.
|
* Get the object by its key.
|
||||||
|
@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class SmithingRecipe implements Recipe, Keyed {
|
@@ -0,0 +0,0 @@ public class SmithingRecipe implements Recipe, Keyed {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice base, @NotNull RecipeChoice addition) {
|
public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @Nullable RecipeChoice base, @Nullable RecipeChoice addition) {
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ this(key, result, base, addition, true);
|
+ this(key, result, base, addition, true);
|
||||||
+ }
|
+ }
|
||||||
@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ * @deprecated use {@link SmithingTrimRecipe} or {@link SmithingTransformRecipe}
|
+ * @deprecated use {@link SmithingTrimRecipe} or {@link SmithingTransformRecipe}
|
||||||
+ */
|
+ */
|
||||||
+ @Deprecated
|
+ @Deprecated
|
||||||
+ public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) {
|
+ public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @Nullable RecipeChoice base, @Nullable RecipeChoice addition, boolean copyDataComponents) {
|
||||||
+ this.copyDataComponents = copyDataComponents;
|
+ this.copyDataComponents = copyDataComponents;
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
this.key = key;
|
this.key = key;
|
||||||
@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ * @param addition The addition ingredient
|
+ * @param addition The addition ingredient
|
||||||
+ * @param copyDataComponents whether to copy the data components from the input base item to the output
|
+ * @param copyDataComponents whether to copy the data components from the input base item to the output
|
||||||
+ */
|
+ */
|
||||||
+ public SmithingTransformRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) {
|
+ public SmithingTransformRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @Nullable RecipeChoice template, @Nullable RecipeChoice base, @Nullable RecipeChoice addition, boolean copyDataComponents) {
|
||||||
+ super(key, result, base, addition, copyDataComponents);
|
+ super(key, result, base, addition, copyDataComponents);
|
||||||
+ this.template = template;
|
+ this.template = template;
|
||||||
+ }
|
+ }
|
||||||
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -0,0 +0,0 @@ dependencies {
|
@@ -0,0 +0,0 @@ dependencies {
|
||||||
implementation("org.ow2.asm:asm-commons:9.7")
|
implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
- compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
|
- compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
|
||||||
|
@ -873,7 +873,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper end - RegistrySet API
|
+ // Paper end - RegistrySet API
|
||||||
+
|
+
|
||||||
/**
|
/**
|
||||||
* Returns a new stream, which contains all registry items, which are registered to the registry.
|
* Get the object by its key.
|
||||||
*
|
*
|
||||||
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
return value.getKey();
|
return value.getKey();
|
||||||
|
@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
||||||
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
||||||
+
|
+
|
||||||
+ implementation("org.ow2.asm:asm:9.7")
|
+ implementation("org.ow2.asm:asm:9.7.1")
|
||||||
+ implementation("org.ow2.asm:asm-commons:9.7")
|
+ implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
|
compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
|
||||||
|
@ -32,7 +32,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftAnvilView.
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftAnvilView.java
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftAnvilView.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftAnvilView.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftAnvilView.java
|
||||||
@@ -0,0 +0,0 @@ public class CraftAnvilView extends CraftInventoryView<AnvilMenu> implements Anv
|
@@ -0,0 +0,0 @@ public class CraftAnvilView extends CraftInventoryView<AnvilMenu, AnvilInventory
|
||||||
this.container.maximumRepairCost = cost;
|
this.container.maximumRepairCost = cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
||||||
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
||||||
@@ -0,0 +0,0 @@ public class ItemMetaTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class ItemMetaTest {
|
||||||
final CraftMetaArmorStand meta = (CraftMetaArmorStand) cleanStack.getItemMeta();
|
final CraftMetaArmorStand meta = (CraftMetaArmorStand) cleanStack.getItemMeta();
|
||||||
meta.entityTag = new CompoundTag();
|
meta.entityTag = new CompoundTag();
|
||||||
meta.entityTag.putBoolean("Small", true);
|
meta.entityTag.putBoolean("Small", true);
|
||||||
|
@ -106,7 +106,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
+import org.bukkit.inventory.ItemStack;
|
+import org.bukkit.inventory.ItemStack;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.bukkit.util.Vector;
|
+import org.bukkit.util.Vector;
|
||||||
+import org.jetbrains.annotations.NotNull;
|
+import org.jetbrains.annotations.NotNull;
|
||||||
+import org.junit.jupiter.api.Assertions;
|
+import org.junit.jupiter.api.Assertions;
|
||||||
@ -122,7 +122,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ * This test is responsible for ensuring that said logic emits the expected destroy speed under heavy attribute
|
+ * This test is responsible for ensuring that said logic emits the expected destroy speed under heavy attribute
|
||||||
+ * modifier use.
|
+ * modifier use.
|
||||||
+ */
|
+ */
|
||||||
+public class CraftBlockDataDestroySpeedTest extends AbstractTestingBase {
|
+@AllFeatures
|
||||||
|
+public class CraftBlockDataDestroySpeedTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
+ public void testCorrectEnchantmentDestroySpeedComputation() {
|
+ public void testCorrectEnchantmentDestroySpeedComputation() {
|
||||||
|
@ -56,9 +56,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
if (j >= this.getMaxDamage()) {
|
if (j >= this.getMaxDamage()) {
|
||||||
Item item = this.getItem();
|
Item item = this.getItem();
|
||||||
// CraftBukkit start - Check for item breaking
|
// CraftBukkit start - Check for item breaking
|
||||||
- if (this.count == 1) {
|
- if (this.count == 1 && player != null) {
|
||||||
- org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent(player, this);
|
- org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent(player, this);
|
||||||
+ if (this.count == 1 && player instanceof final ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
|
+ if (this.count == 1 && player != null && player instanceof final ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
|
||||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent(serverPlayer, this); // Paper - Add EntityDamageItemEvent
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent(serverPlayer, this); // Paper - Add EntityDamageItemEvent
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -338,7 +338,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import java.util.Set;
|
+import java.util.Set;
|
||||||
+import java.util.stream.Stream;
|
+import java.util.stream.Stream;
|
||||||
+import net.kyori.adventure.key.Key;
|
+import net.kyori.adventure.key.Key;
|
||||||
+import net.minecraft.core.registries.Registries;
|
|
||||||
+import net.minecraft.resources.ResourceKey;
|
+import net.minecraft.resources.ResourceKey;
|
||||||
+import net.minecraft.resources.ResourceLocation;
|
+import net.minecraft.resources.ResourceLocation;
|
||||||
+import net.minecraft.world.flag.FeatureElement;
|
+import net.minecraft.world.flag.FeatureElement;
|
||||||
@ -346,7 +345,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import net.minecraft.world.flag.FeatureFlags;
|
+import net.minecraft.world.flag.FeatureFlags;
|
||||||
+import org.bukkit.FeatureFlag;
|
+import org.bukkit.FeatureFlag;
|
||||||
+import org.bukkit.Keyed;
|
+import org.bukkit.Keyed;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.RegistryHelper;
|
||||||
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+import org.junit.jupiter.params.ParameterizedTest;
|
+import org.junit.jupiter.params.ParameterizedTest;
|
||||||
+import org.junit.jupiter.params.provider.MethodSource;
|
+import org.junit.jupiter.params.provider.MethodSource;
|
||||||
@ -358,7 +358,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
+import static org.junit.jupiter.api.Assertions.fail;
|
+import static org.junit.jupiter.api.Assertions.fail;
|
||||||
+
|
+
|
||||||
+class FeatureFlagTest extends AbstractTestingBase {
|
+@AllFeatures
|
||||||
|
+class FeatureFlagTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
+ void testFeatureFlagParity() {
|
+ void testFeatureFlagParity() {
|
||||||
@ -409,7 +410,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ static Stream<RegistryKey<?>> nonFeatureFilteredRegistries() {
|
+ static Stream<RegistryKey<?>> nonFeatureFilteredRegistries() {
|
||||||
+ return AbstractTestingBase.REGISTRY_CUSTOM.registries().filter(r -> {
|
+ return RegistryHelper.getRegistry().registries().filter(r -> {
|
||||||
+ final RegistryEntry<?, ?> entry = PaperRegistries.getEntry(r.key());
|
+ final RegistryEntry<?, ?> entry = PaperRegistries.getEntry(r.key());
|
||||||
+ // has an API registry and isn't a filtered registry
|
+ // has an API registry and isn't a filtered registry
|
||||||
+ return entry != null && !FeatureElement.FILTERED_REGISTRIES.contains(r.key());
|
+ return entry != null && !FeatureElement.FILTERED_REGISTRIES.contains(r.key());
|
||||||
|
@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import net.minecraft.world.item.ItemStack;
|
+import net.minecraft.world.item.ItemStack;
|
||||||
+import org.bukkit.Material;
|
+import org.bukkit.Material;
|
||||||
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.junit.jupiter.params.ParameterizedTest;
|
+import org.junit.jupiter.params.ParameterizedTest;
|
||||||
+import org.junit.jupiter.params.provider.MethodSource;
|
+import org.junit.jupiter.params.provider.MethodSource;
|
||||||
+
|
+
|
||||||
@ -48,7 +48,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
+
|
+
|
||||||
+public class ArmorSlotTypeMaterialTest extends AbstractTestingBase {
|
+@AllFeatures
|
||||||
|
+public class ArmorSlotTypeMaterialTest {
|
||||||
+
|
+
|
||||||
+ public static Stream<Object[]> slotTypeParams() {
|
+ public static Stream<Object[]> slotTypeParams() {
|
||||||
+ final List<Object[]> parameters = new ArrayList<>();
|
+ final List<Object[]> parameters = new ArrayList<>();
|
||||||
|
@ -568,6 +568,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import java.util.Iterator;
|
+import java.util.Iterator;
|
||||||
+import java.util.function.Supplier;
|
+import java.util.function.Supplier;
|
||||||
+import java.util.stream.Stream;
|
+import java.util.stream.Stream;
|
||||||
|
+import net.kyori.adventure.key.Key;
|
||||||
+import org.bukkit.Keyed;
|
+import org.bukkit.Keyed;
|
||||||
+import org.bukkit.NamespacedKey;
|
+import org.bukkit.NamespacedKey;
|
||||||
+import org.bukkit.Registry;
|
+import org.bukkit.Registry;
|
||||||
@ -604,6 +605,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
|
+ public @NotNull T getOrThrow(@NotNull final NamespacedKey key) {
|
||||||
|
+ return this.delegate().getOrThrow(key);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
+ public Iterator<T> iterator() {
|
+ public Iterator<T> iterator() {
|
||||||
+ return this.delegate().iterator();
|
+ return this.delegate().iterator();
|
||||||
+ }
|
+ }
|
||||||
@ -914,11 +920,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||||
@@ -0,0 +0,0 @@ public class Commodore {
|
@@ -0,0 +0,0 @@ public class Commodore {
|
||||||
|
|
||||||
public static byte[] convert(byte[] b, final String pluginName, final ApiVersion pluginVersion, final Set<String> activeCompatibilities) {
|
public byte[] convert(byte[] b, final String pluginName, final ApiVersion pluginVersion, final Set<String> activeCompatibilities) {
|
||||||
final boolean modern = pluginVersion.isNewerThanOrSameAs(ApiVersion.FLATTENING);
|
final boolean modern = pluginVersion.isNewerThanOrSameAs(ApiVersion.FLATTENING);
|
||||||
- final boolean enumCompatibility = pluginVersion.isOlderThanOrSameAs(ApiVersion.getOrCreateVersion("1.20.6")) && activeCompatibilities.contains("enum-compatibility-mode");
|
- final boolean enumCompatibility = pluginVersion.isOlderThanOrSameAs(ApiVersion.getOrCreateVersion("1.20.6")) && activeCompatibilities.contains("enum-compatibility-mode");
|
||||||
ClassReader cr = new ClassReader(b);
|
ClassReader cr = new ClassReader(b);
|
||||||
ClassWriter cw = new ClassWriter(0); // TODO 2024-06-22: Open PR to ASM to included interface in handle hash
|
ClassWriter cw = new ClassWriter(cr, 0);
|
||||||
|
|
||||||
- List<String> methodEnumSignatures = Commodore.getMethodSignatures(b);
|
- List<String> methodEnumSignatures = Commodore.getMethodSignatures(b);
|
||||||
- Multimap<String, String> enumLessToEnum = HashMultimap.create();
|
- Multimap<String, String> enumLessToEnum = HashMultimap.create();
|
||||||
@ -981,13 +987,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import org.bukkit.GameEvent;
|
+import org.bukkit.GameEvent;
|
||||||
+import org.bukkit.MusicInstrument;
|
+import org.bukkit.MusicInstrument;
|
||||||
+import org.bukkit.inventory.meta.trim.TrimPattern;
|
+import org.bukkit.inventory.meta.trim.TrimPattern;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.VanillaFeature;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertSame;
|
+import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
+
|
+
|
||||||
+@Deprecated
|
+@Deprecated
|
||||||
+class LegacyRegistryIdentifierTest extends AbstractTestingBase {
|
+@VanillaFeature
|
||||||
|
+class LegacyRegistryIdentifierTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
+ void testSeveralConversions() {
|
+ void testSeveralConversions() {
|
||||||
@ -1009,8 +1016,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
+import org.bukkit.Keyed;
|
-import org.bukkit.support.AbstractTestingBase;
|
||||||
import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.RegistryHelper;
|
||||||
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
@ -1019,10 +1027,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
class RegistryKeyTest extends AbstractTestingBase {
|
@AllFeatures
|
||||||
@@ -0,0 +0,0 @@ class RegistryKeyTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ class RegistryKeyTest {
|
||||||
void testApiRegistryKeysExist(final RegistryKey<?> key) {
|
void testApiRegistryKeysExist(final RegistryKey<?> key) {
|
||||||
final Optional<Registry<Object>> registry = AbstractTestingBase.REGISTRY_CUSTOM.registry(ResourceKey.createRegistryKey(ResourceLocation.parse(key.key().asString())));
|
final Optional<Registry<Object>> registry = RegistryHelper.getRegistry().registry(ResourceKey.createRegistryKey(ResourceLocation.parse(key.key().asString())));
|
||||||
assertTrue(registry.isPresent(), "Missing vanilla registry for " + key.key().asString());
|
assertTrue(registry.isPresent(), "Missing vanilla registry for " + key.key().asString());
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
@ -1037,11 +1045,11 @@ diff --git a/src/test/java/org/bukkit/registry/RegistryArgumentAddedTest.java b/
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/registry/RegistryArgumentAddedTest.java
|
--- a/src/test/java/org/bukkit/registry/RegistryArgumentAddedTest.java
|
||||||
+++ b/src/test/java/org/bukkit/registry/RegistryArgumentAddedTest.java
|
+++ b/src/test/java/org/bukkit/registry/RegistryArgumentAddedTest.java
|
||||||
@@ -0,0 +0,0 @@ public class RegistryArgumentAddedTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class RegistryArgumentAddedTest {
|
||||||
// Make sure every registry is created
|
// Make sure every registry is created
|
||||||
Class.forName(Registry.class.getName());
|
Class.forName(Registry.class.getName());
|
||||||
|
|
||||||
- Set<Class<?>> loadedRegistries = new HashSet<>(DummyServer.registers.keySet());
|
- Set<Class<?>> loadedRegistries = new HashSet<>(AllFeaturesExtension.getRealRegistries().keySet());
|
||||||
- Set<Class<?>> notFound = new HashSet<>();
|
- Set<Class<?>> notFound = new HashSet<>();
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ Set<io.papermc.paper.registry.RegistryKey<?>> loadedRegistries = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>());
|
+ Set<io.papermc.paper.registry.RegistryKey<?>> loadedRegistries = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>());
|
||||||
@ -1062,7 +1070,7 @@ diff --git a/src/test/java/org/bukkit/registry/RegistryConversionTest.java b/src
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/registry/RegistryConversionTest.java
|
--- a/src/test/java/org/bukkit/registry/RegistryConversionTest.java
|
||||||
+++ b/src/test/java/org/bukkit/registry/RegistryConversionTest.java
|
+++ b/src/test/java/org/bukkit/registry/RegistryConversionTest.java
|
||||||
@@ -0,0 +0,0 @@ public class RegistryConversionTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class RegistryConversionTest {
|
||||||
|
|
||||||
@Order(1)
|
@Order(1)
|
||||||
@RegistriesTest
|
@RegistriesTest
|
||||||
@ -1074,7 +1082,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
for (Keyed item : registry) {
|
for (Keyed item : registry) {
|
||||||
if (!(item instanceof Handleable<?>)) {
|
if (!(item instanceof Handleable<?>)) {
|
||||||
@@ -0,0 +0,0 @@ public class RegistryConversionTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class RegistryConversionTest {
|
||||||
|
|
||||||
@Order(2)
|
@Order(2)
|
||||||
@RegistriesTest
|
@RegistriesTest
|
||||||
@ -1083,7 +1091,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
Class<? extends Keyed> craftClazz, Class<?> minecraftClazz, boolean newMethod) {
|
Class<? extends Keyed> craftClazz, Class<?> minecraftClazz, boolean newMethod) {
|
||||||
String methodName = (newMethod) ? RegistryConversionTest.MINECRAFT_TO_BUKKIT_NEW : RegistryConversionTest.MINECRAFT_TO_BUKKIT;
|
String methodName = (newMethod) ? RegistryConversionTest.MINECRAFT_TO_BUKKIT_NEW : RegistryConversionTest.MINECRAFT_TO_BUKKIT;
|
||||||
Method method = null;
|
Method method = null;
|
||||||
@@ -0,0 +0,0 @@ public class RegistryConversionTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class RegistryConversionTest {
|
||||||
|
|
||||||
@Order(2)
|
@Order(2)
|
||||||
@RegistriesTest
|
@RegistriesTest
|
||||||
@ -1092,7 +1100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
Class<? extends Keyed> craftClazz, Class<?> minecraftClazz, boolean newMethod) {
|
Class<? extends Keyed> craftClazz, Class<?> minecraftClazz, boolean newMethod) {
|
||||||
String methodName = (newMethod) ? RegistryConversionTest.BUKKIT_TO_MINECRAFT_NEW : RegistryConversionTest.BUKKIT_TO_MINECRAFT;
|
String methodName = (newMethod) ? RegistryConversionTest.BUKKIT_TO_MINECRAFT_NEW : RegistryConversionTest.BUKKIT_TO_MINECRAFT;
|
||||||
Method method = null;
|
Method method = null;
|
||||||
@@ -0,0 +0,0 @@ public class RegistryConversionTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class RegistryConversionTest {
|
||||||
""", minecraftClazz.getName(), methodName, clazz.getSimpleName());
|
""", minecraftClazz.getName(), methodName, clazz.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1104,7 +1112,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.checkValidMinecraftToBukkit(clazz);
|
this.checkValidMinecraftToBukkit(clazz);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -0,0 +0,0 @@ public class RegistryConversionTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class RegistryConversionTest {
|
||||||
|
|
||||||
@Order(3)
|
@Order(3)
|
||||||
@RegistriesTest
|
@RegistriesTest
|
||||||
@ -1113,7 +1121,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.checkValidBukkitToMinecraft(clazz);
|
this.checkValidBukkitToMinecraft(clazz);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -0,0 +0,0 @@ public class RegistryConversionTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class RegistryConversionTest {
|
||||||
|
|
||||||
@Order(3)
|
@Order(3)
|
||||||
@RegistriesTest
|
@RegistriesTest
|
||||||
@ -1130,7 +1138,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
Keyed bukkit = (Keyed) arguments[0];
|
Keyed bukkit = (Keyed) arguments[0];
|
||||||
Object minecraft = arguments[1];
|
Object minecraft = arguments[1];
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class RegistryConversionTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class RegistryConversionTest {
|
||||||
|
|
||||||
@Order(3)
|
@Order(3)
|
||||||
@RegistriesTest
|
@RegistriesTest
|
||||||
@ -1147,7 +1155,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
Keyed bukkit = (Keyed) arguments[0];
|
Keyed bukkit = (Keyed) arguments[0];
|
||||||
Object minecraft = arguments[1];
|
Object minecraft = arguments[1];
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class RegistryConversionTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class RegistryConversionTest {
|
||||||
*/
|
*/
|
||||||
@Order(3)
|
@Order(3)
|
||||||
@RegistriesTest
|
@RegistriesTest
|
||||||
@ -1156,22 +1164,85 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
Class<? extends Keyed> craftClazz, Class<?> minecraftClazz) throws IllegalAccessException {
|
Class<? extends Keyed> craftClazz, Class<?> minecraftClazz) throws IllegalAccessException {
|
||||||
this.checkValidMinecraftToBukkit(clazz);
|
this.checkValidMinecraftToBukkit(clazz);
|
||||||
|
|
||||||
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
diff --git a/src/test/java/org/bukkit/support/extension/AllFeaturesExtension.java b/src/test/java/org/bukkit/support/extension/AllFeaturesExtension.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
--- a/src/test/java/org/bukkit/support/extension/AllFeaturesExtension.java
|
||||||
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
+++ b/src/test/java/org/bukkit/support/extension/AllFeaturesExtension.java
|
||||||
@@ -0,0 +0,0 @@ public final class DummyServer {
|
@@ -0,0 +0,0 @@ public class AllFeaturesExtension extends BaseExtension {
|
||||||
when(instance.getLootTable(any())).then(mock -> new CraftLootTable(mock.getArgument(0),
|
|
||||||
AbstractTestingBase.DATA_PACK.fullRegistries().getLootTable(ResourceKey.create(Registries.LOOT_TABLE, CraftNamespacedKey.toMinecraft(mock.getArgument(0))))));
|
|
||||||
|
|
||||||
- when(instance.getRegistry(any())).then((Answer<Registry<?>>) mock -> {
|
Bukkit.setServer(server);
|
||||||
- Class<? extends Keyed> aClass = mock.getArgument(0);
|
|
||||||
- return registers.computeIfAbsent(aClass, key -> CraftRegistry.createRegistry(aClass, AbstractTestingBase.REGISTRY_CUSTOM));
|
- when(server.getRegistry(any()))
|
||||||
|
- .then(invocation -> {
|
||||||
|
- Class<? extends Keyed> keyed = invocation.getArgument(0);
|
||||||
|
- if (spyRegistries.containsKey(keyed)) {
|
||||||
|
- return spyRegistries.get(keyed);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- Registry<?> registry = CraftRegistry.createRegistry(keyed, RegistryHelper.getRegistry());
|
||||||
|
- realRegistries.put(keyed, registry);
|
||||||
|
-
|
||||||
|
- Registry<?> spy = mock(registry.getClass(), withSettings().stubOnly().spiedInstance(registry).defaultAnswer(CALLS_REAL_METHODS));
|
||||||
|
-
|
||||||
|
- spyRegistries.put(keyed, spy);
|
||||||
|
-
|
||||||
|
- return spy;
|
||||||
- });
|
- });
|
||||||
+ // Paper - RegistryAccess
|
+ // Paper - Add RegistryAccess for managing registries - replaced with registry access
|
||||||
|
|
||||||
when(instance.getTag(any(), any(), any())).then(mock -> {
|
CraftRegistry.setMinecraftRegistry(RegistryHelper.getRegistry());
|
||||||
String registry = mock.getArgument(0);
|
}
|
||||||
|
diff --git a/src/test/java/org/bukkit/support/extension/LegacyExtension.java b/src/test/java/org/bukkit/support/extension/LegacyExtension.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/test/java/org/bukkit/support/extension/LegacyExtension.java
|
||||||
|
+++ b/src/test/java/org/bukkit/support/extension/LegacyExtension.java
|
||||||
|
@@ -0,0 +0,0 @@ public class LegacyExtension extends BaseExtension {
|
||||||
|
|
||||||
|
Bukkit.setServer(server);
|
||||||
|
|
||||||
|
- when(server.getRegistry(any()))
|
||||||
|
- .then(invocation -> {
|
||||||
|
- Class<? extends Keyed> keyed = invocation.getArgument(0);
|
||||||
|
- return registries.computeIfAbsent(keyed, k -> CraftRegistry.createRegistry(keyed, RegistryHelper.getRegistry()));
|
||||||
|
- });
|
||||||
|
+ // Paper - Add RegistryAccess for managing registries - replaced with registry access
|
||||||
|
|
||||||
|
CraftRegistry.setMinecraftRegistry(RegistryHelper.getRegistry());
|
||||||
|
}
|
||||||
|
diff --git a/src/test/java/org/bukkit/support/extension/SlowExtension.java b/src/test/java/org/bukkit/support/extension/SlowExtension.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/test/java/org/bukkit/support/extension/SlowExtension.java
|
||||||
|
+++ b/src/test/java/org/bukkit/support/extension/SlowExtension.java
|
||||||
|
@@ -0,0 +0,0 @@ public class SlowExtension extends BaseExtension {
|
||||||
|
|
||||||
|
Bukkit.setServer(server);
|
||||||
|
|
||||||
|
- when(server.getRegistry(any()))
|
||||||
|
- .then(invocation -> {
|
||||||
|
- Class<? extends Keyed> keyed = invocation.getArgument(0);
|
||||||
|
- return registries.computeIfAbsent(keyed, k -> CraftRegistry.createRegistry(keyed, RegistryHelper.getRegistry()));
|
||||||
|
- });
|
||||||
|
+ // Paper - Add RegistryAccess for managing registries - replaced with registry access
|
||||||
|
|
||||||
|
CraftRegistry.setMinecraftRegistry(RegistryHelper.getRegistry());
|
||||||
|
}
|
||||||
|
diff --git a/src/test/java/org/bukkit/support/extension/VanillaFeatureExtension.java b/src/test/java/org/bukkit/support/extension/VanillaFeatureExtension.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/test/java/org/bukkit/support/extension/VanillaFeatureExtension.java
|
||||||
|
+++ b/src/test/java/org/bukkit/support/extension/VanillaFeatureExtension.java
|
||||||
|
@@ -0,0 +0,0 @@ public class VanillaFeatureExtension extends BaseExtension {
|
||||||
|
|
||||||
|
Bukkit.setServer(server);
|
||||||
|
|
||||||
|
- when(server.getRegistry(any()))
|
||||||
|
- .then(invocation -> {
|
||||||
|
- Class<? extends Keyed> keyed = invocation.getArgument(0);
|
||||||
|
- return registries.computeIfAbsent(keyed, k -> CraftRegistry.createRegistry(keyed, RegistryHelper.getRegistry()));
|
||||||
|
- });
|
||||||
|
+ // Paper - Add RegistryAccess for managing registries - replaced with registry access
|
||||||
|
|
||||||
|
CraftRegistry.setMinecraftRegistry(RegistryHelper.getRegistry());
|
||||||
|
}
|
||||||
diff --git a/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java b/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java
|
diff --git a/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java b/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java
|
--- a/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java
|
||||||
|
@ -97,10 +97,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import java.util.List;
|
+import java.util.List;
|
||||||
+import net.minecraft.world.entity.Mob;
|
+import net.minecraft.world.entity.Mob;
|
||||||
+import net.minecraft.world.entity.Shearable;
|
+import net.minecraft.world.entity.Shearable;
|
||||||
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.api.Assertions;
|
+import org.junit.jupiter.api.Assertions;
|
||||||
+import org.junit.jupiter.params.ParameterizedTest;
|
+import org.junit.jupiter.params.ParameterizedTest;
|
||||||
+import org.junit.jupiter.params.provider.MethodSource;
|
+import org.junit.jupiter.params.provider.MethodSource;
|
||||||
+
|
+
|
||||||
|
+@Normal
|
||||||
+class ShearableTest {
|
+class ShearableTest {
|
||||||
+
|
+
|
||||||
+ static List<Class<Shearable>> nmsShearables() {
|
+ static List<Class<Shearable>> nmsShearables() {
|
||||||
|
@ -382,13 +382,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import io.github.classgraph.ScanResult;
|
+import io.github.classgraph.ScanResult;
|
||||||
+import java.util.ArrayList;
|
+import java.util.ArrayList;
|
||||||
+import net.minecraft.world.entity.Shearable;
|
+import net.minecraft.world.entity.Shearable;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.params.ParameterizedTest;
|
+import org.junit.jupiter.params.ParameterizedTest;
|
||||||
+import org.junit.jupiter.params.provider.MethodSource;
|
+import org.junit.jupiter.params.provider.MethodSource;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
+
|
+
|
||||||
+class ShearableDropsTest extends AbstractTestingBase {
|
+@Normal
|
||||||
|
+class ShearableDropsTest {
|
||||||
+
|
+
|
||||||
+ static Iterable<ClassInfo> parameters() {
|
+ static Iterable<ClassInfo> parameters() {
|
||||||
+ try (ScanResult scanResult = new ClassGraph()
|
+ try (ScanResult scanResult = new ClassGraph()
|
||||||
|
@ -23,7 +23,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftEnchantmen
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftEnchantmentView.java
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftEnchantmentView.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftEnchantmentView.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftEnchantmentView.java
|
||||||
@@ -0,0 +0,0 @@ public class CraftEnchantmentView extends CraftInventoryView<EnchantmentMenu> im
|
@@ -0,0 +0,0 @@ public class CraftEnchantmentView extends CraftInventoryView<EnchantmentMenu, En
|
||||||
return this.container.getEnchantmentSeed();
|
return this.container.getEnchantmentSeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,16 +116,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import org.bukkit.MusicInstrument;
|
+import org.bukkit.MusicInstrument;
|
||||||
+import org.bukkit.attribute.Attribute;
|
+import org.bukkit.attribute.Attribute;
|
||||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.RegistryHelper;
|
||||||
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
+import org.junit.jupiter.api.Disabled;
|
+import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
-public class TranslationKeyTest {
|
+@AllFeatures
|
||||||
+public class TranslationKeyTest extends AbstractTestingBase {
|
public class TranslationKeyTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testChatVisibilityKeys() {
|
|
||||||
@@ -0,0 +0,0 @@ public class TranslationKeyTest {
|
@@ -0,0 +0,0 @@ public class TranslationKeyTest {
|
||||||
Assertions.assertEquals(ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey(), chatVisibility + "'s translation key doesn't match");
|
Assertions.assertEquals(ChatVisiblity.valueOf(chatVisibility.name()).getKey(), chatVisibility.translationKey(), chatVisibility + "'s translation key doesn't match");
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
+ public void testBiome() {
|
+ public void testBiome() {
|
||||||
+ for (Map.Entry<ResourceKey<Biome>, Biome> nms : AbstractTestingBase.BIOMES.entrySet()) {
|
+ for (Map.Entry<ResourceKey<Biome>, Biome> nms : RegistryHelper.getBiomes().entrySet()) {
|
||||||
+ org.bukkit.block.Biome bukkit = org.bukkit.block.Biome.valueOf(nms.getKey().location().getPath().toUpperCase(Locale.ROOT));
|
+ org.bukkit.block.Biome bukkit = org.bukkit.block.Biome.valueOf(nms.getKey().location().getPath().toUpperCase(Locale.ROOT));
|
||||||
+ Assertions.assertEquals(nms.getKey().location().toLanguageKey("biome"), bukkit.translationKey(), "translation key mismatch for " + bukkit);
|
+ Assertions.assertEquals(nms.getKey().location().toLanguageKey("biome"), bukkit.translationKey(), "translation key mismatch for " + bukkit);
|
||||||
+ }
|
+ }
|
||||||
|
@ -96,6 +96,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+import com.mojang.brigadier.tree.CommandNode;
|
+import com.mojang.brigadier.tree.CommandNode;
|
||||||
+import com.mojang.brigadier.tree.RootCommandNode;
|
+import com.mojang.brigadier.tree.RootCommandNode;
|
||||||
|
+import java.io.PrintStream;
|
||||||
|
+import java.util.HashSet;
|
||||||
|
+import java.util.LinkedHashSet;
|
||||||
|
+import java.util.List;
|
||||||
|
+import java.util.Set;
|
||||||
|
+import java.util.TreeSet;
|
||||||
+import net.minecraft.commands.CommandBuildContext;
|
+import net.minecraft.commands.CommandBuildContext;
|
||||||
+import net.minecraft.commands.CommandSourceStack;
|
+import net.minecraft.commands.CommandSourceStack;
|
||||||
+import net.minecraft.commands.Commands;
|
+import net.minecraft.commands.Commands;
|
||||||
@ -105,21 +111,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
|
+import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
|
||||||
+import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
|
+import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
|
||||||
+import org.bukkit.permissions.Permission;
|
+import org.bukkit.permissions.Permission;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.RegistryHelper;
|
||||||
|
+import org.bukkit.support.environment.VanillaFeature;
|
||||||
+import org.junit.jupiter.api.AfterAll;
|
+import org.junit.jupiter.api.AfterAll;
|
||||||
+import org.junit.jupiter.api.BeforeAll;
|
+import org.junit.jupiter.api.BeforeAll;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import java.io.PrintStream;
|
|
||||||
+import java.util.HashSet;
|
|
||||||
+import java.util.LinkedHashSet;
|
|
||||||
+import java.util.List;
|
|
||||||
+import java.util.Set;
|
|
||||||
+import java.util.TreeSet;
|
|
||||||
+
|
|
||||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
+
|
+
|
||||||
+public class MinecraftCommandPermissionsTest extends AbstractTestingBase {
|
+@VanillaFeature
|
||||||
|
+public class MinecraftCommandPermissionsTest {
|
||||||
+
|
+
|
||||||
+ private static PrintStream old;
|
+ private static PrintStream old;
|
||||||
+ @BeforeAll
|
+ @BeforeAll
|
||||||
@ -133,7 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ CraftDefaultPermissions.registerCorePermissions();
|
+ CraftDefaultPermissions.registerCorePermissions();
|
||||||
+ Set<String> perms = collectMinecraftCommandPerms();
|
+ Set<String> perms = collectMinecraftCommandPerms();
|
||||||
+
|
+
|
||||||
+ Commands commands = new Commands(Commands.CommandSelection.DEDICATED, CommandBuildContext.simple(AbstractTestingBase.REGISTRY_CUSTOM, FeatureFlags.VANILLA_SET));
|
+ Commands commands = new Commands(Commands.CommandSelection.DEDICATED, CommandBuildContext.simple(RegistryHelper.getRegistry(), FeatureFlags.VANILLA_SET));
|
||||||
+ RootCommandNode<CommandSourceStack> root = commands.getDispatcher().getRoot();
|
+ RootCommandNode<CommandSourceStack> root = commands.getDispatcher().getRoot();
|
||||||
+ Set<String> missing = new LinkedHashSet<>();
|
+ Set<String> missing = new LinkedHashSet<>();
|
||||||
+ Set<String> foundPerms = new HashSet<>();
|
+ Set<String> foundPerms = new HashSet<>();
|
||||||
|
@ -333,7 +333,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import net.minecraft.world.level.levelgen.structure.StructureSet;
|
+import net.minecraft.world.level.levelgen.structure.StructureSet;
|
||||||
+import net.minecraft.world.level.levelgen.structure.placement.StructurePlacement;
|
+import net.minecraft.world.level.levelgen.structure.placement.StructurePlacement;
|
||||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.RegistryHelper;
|
||||||
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.jetbrains.annotations.NotNull;
|
+import org.jetbrains.annotations.NotNull;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+import org.spigotmc.SpigotConfig;
|
+import org.spigotmc.SpigotConfig;
|
||||||
@ -341,7 +342,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
+
|
+
|
||||||
+public class StructureSeedConfigTest extends AbstractTestingBase {
|
+@AllFeatures
|
||||||
|
+public class StructureSeedConfigTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
+ public void checkStructureSeedDefaults() throws ReflectiveOperationException {
|
+ public void checkStructureSeedDefaults() throws ReflectiveOperationException {
|
||||||
@ -354,7 +356,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ final SpigotWorldConfig config = PaperConfigurations.SPIGOT_WORLD_DEFAULTS.get();
|
+ final SpigotWorldConfig config = PaperConfigurations.SPIGOT_WORLD_DEFAULTS.get();
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+ final Registry<StructureSet> structureSets = AbstractTestingBase.REGISTRY_CUSTOM.registryOrThrow(Registries.STRUCTURE_SET);
|
+ final Registry<StructureSet> structureSets = RegistryHelper.getRegistry().registryOrThrow(Registries.STRUCTURE_SET);
|
||||||
+ for (final ResourceKey<StructureSet> setKey : structureSets.registryKeySet()) {
|
+ for (final ResourceKey<StructureSet> setKey : structureSets.registryKeySet()) {
|
||||||
+ assertEquals(ResourceLocation.DEFAULT_NAMESPACE, setKey.location().getNamespace());
|
+ assertEquals(ResourceLocation.DEFAULT_NAMESPACE, setKey.location().getNamespace());
|
||||||
+ final StructureSet set = structureSets.getOrThrow(setKey);
|
+ final StructureSet set = structureSets.getOrThrow(setKey);
|
||||||
|
@ -90,10 +90,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+import org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations;
|
+import org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations;
|
||||||
+import org.bukkit.scoreboard.DisplaySlot;
|
+import org.bukkit.scoreboard.DisplaySlot;
|
||||||
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
+
|
+
|
||||||
|
+@Normal
|
||||||
+public class DisplaySlotTest {
|
+public class DisplaySlotTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
|
@ -191,10 +191,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import net.kyori.adventure.text.format.TextColor;
|
+import net.kyori.adventure.text.format.TextColor;
|
||||||
+import net.minecraft.advancements.AdvancementType;
|
+import net.minecraft.advancements.AdvancementType;
|
||||||
+import net.minecraft.network.chat.contents.TranslatableContents;
|
+import net.minecraft.network.chat.contents.TranslatableContents;
|
||||||
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
+
|
+
|
||||||
|
+@Normal
|
||||||
+public class AdvancementFrameTest {
|
+public class AdvancementFrameTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
|
@ -324,9 +324,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import java.util.HashSet;
|
+import java.util.HashSet;
|
||||||
+import java.util.Set;
|
+import java.util.Set;
|
||||||
+import net.minecraft.world.entity.MobCategory;
|
+import net.minecraft.world.entity.MobCategory;
|
||||||
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.api.Assertions;
|
+import org.junit.jupiter.api.Assertions;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
|
+@Normal
|
||||||
+public class MobcapsCommandTest {
|
+public class MobcapsCommandTest {
|
||||||
+ @Test
|
+ @Test
|
||||||
+ public void testMobCategoryColors() {
|
+ public void testMobCategoryColors() {
|
||||||
|
@ -161,7 +161,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftBrewingSta
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftBrewingStandView.java
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftBrewingStandView.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftBrewingStandView.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftBrewingStandView.java
|
||||||
@@ -0,0 +0,0 @@ public class CraftBrewingStandView extends CraftInventoryView<BrewingStandMenu>
|
@@ -0,0 +0,0 @@ public class CraftBrewingStandView extends CraftInventoryView<BrewingStandMenu,
|
||||||
Preconditions.checkArgument(brewingTicks > 0, "The given brewing ticks must be greater than 0");
|
Preconditions.checkArgument(brewingTicks > 0, "The given brewing ticks must be greater than 0");
|
||||||
this.container.setData(BrewingStandBlockEntity.DATA_BREW_TIME, brewingTicks);
|
this.container.setData(BrewingStandBlockEntity.DATA_BREW_TIME, brewingTicks);
|
||||||
}
|
}
|
||||||
|
@ -459,16 +459,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
+import net.minecraft.world.item.enchantment.Enchantment;
|
+import net.minecraft.world.item.enchantment.Enchantment;
|
||||||
+import net.minecraft.world.level.gameevent.GameEvent;
|
+import net.minecraft.world.level.gameevent.GameEvent;
|
||||||
import org.bukkit.support.AbstractTestingBase;
|
import org.bukkit.support.RegistryHelper;
|
||||||
-import org.junit.jupiter.api.Disabled;
|
import org.bukkit.support.environment.AllFeatures;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.params.provider.Arguments;
|
@@ -0,0 +0,0 @@ import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
+import static org.junit.jupiter.params.provider.Arguments.arguments;
|
+import static org.junit.jupiter.params.provider.Arguments.arguments;
|
||||||
|
|
||||||
class RegistryBuilderTest extends AbstractTestingBase {
|
@AllFeatures
|
||||||
|
class RegistryBuilderTest {
|
||||||
|
|
||||||
static List<Arguments> registries() {
|
static List<Arguments> registries() {
|
||||||
return List.of(
|
return List.of(
|
||||||
|
@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ implementation("io.netty:netty-codec-haproxy:4.1.97.Final") // Paper - Add support for proxy protocol
|
+ implementation("io.netty:netty-codec-haproxy:4.1.97.Final") // Paper - Add support for proxy protocol
|
||||||
// Paper end
|
// Paper end
|
||||||
implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
|
implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
|
||||||
implementation("org.ow2.asm:asm-commons:9.7")
|
implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
||||||
|
@ -97,7 +97,7 @@ diff --git a/src/test/java/org/bukkit/craftbukkit/legacy/MaterialReroutingTest.j
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/craftbukkit/legacy/MaterialReroutingTest.java
|
--- a/src/test/java/org/bukkit/craftbukkit/legacy/MaterialReroutingTest.java
|
||||||
+++ b/src/test/java/org/bukkit/craftbukkit/legacy/MaterialReroutingTest.java
|
+++ b/src/test/java/org/bukkit/craftbukkit/legacy/MaterialReroutingTest.java
|
||||||
@@ -0,0 +0,0 @@ public class MaterialReroutingTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class MaterialReroutingTest {
|
||||||
.filter(entry -> !entry.getName().endsWith("ItemType.class"))
|
.filter(entry -> !entry.getName().endsWith("ItemType.class"))
|
||||||
.filter(entry -> !entry.getName().endsWith("Registry.class"))
|
.filter(entry -> !entry.getName().endsWith("Registry.class"))
|
||||||
.filter(entry -> !entry.getName().startsWith("org/bukkit/material"))
|
.filter(entry -> !entry.getName().startsWith("org/bukkit/material"))
|
||||||
@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
.map(entry -> {
|
.map(entry -> {
|
||||||
try {
|
try {
|
||||||
return MaterialReroutingTest.jarFile.getInputStream(entry);
|
return MaterialReroutingTest.jarFile.getInputStream(entry);
|
||||||
@@ -0,0 +0,0 @@ public class MaterialReroutingTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class MaterialReroutingTest {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,9 +116,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ if (isInternal(methodNode.invisibleAnnotations)) continue;
|
+ if (isInternal(methodNode.invisibleAnnotations)) continue;
|
||||||
+ // Paper end - filter out more methods from rerouting test
|
+ // Paper end - filter out more methods from rerouting test
|
||||||
|
|
||||||
if (!Commodore.rerouteMethods(Collections.emptySet(), ApiVersion.CURRENT, MaterialReroutingTest.MATERIAL_METHOD_REROUTE, (methodNode.access & Opcodes.ACC_STATIC) != 0, classNode.name, methodNode.name, methodNode.desc, a -> { })) {
|
if (!Commodore.rerouteMethods(ApiVersion.CURRENT, MaterialReroutingTest.MATERIAL_METHOD_REROUTE, (methodNode.access & Opcodes.ACC_STATIC) != 0, classNode.name, methodNode.name, methodNode.desc, a -> { })) {
|
||||||
missingReroute.add(methodNode.name + " " + methodNode.desc + " " + methodNode.signature);
|
missingReroute.add(methodNode.name + " " + methodNode.desc + " " + methodNode.signature);
|
||||||
@@ -0,0 +0,0 @@ public class MaterialReroutingTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class MaterialReroutingTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4806,7 +4806,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.j
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java
|
||||||
@@ -0,0 +0,0 @@ public class CraftInventoryView<T extends AbstractContainerMenu> extends CraftAb
|
@@ -0,0 +0,0 @@ public class CraftInventoryView<T extends AbstractContainerMenu, I extends Inven
|
||||||
return CraftItemStack.asCraftMirror(this.container.getSlot(slot).getItem());
|
return CraftItemStack.asCraftMirror(this.container.getSlot(slot).getItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5195,7 +5195,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null);
|
return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasJukeboxPlayable() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
@ -5828,7 +5828,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import net.minecraft.world.item.ItemStack;
|
+import net.minecraft.world.item.ItemStack;
|
||||||
+import net.minecraft.world.item.Items;
|
+import net.minecraft.world.item.Items;
|
||||||
+import org.apache.commons.lang3.RandomStringUtils;
|
+import org.apache.commons.lang3.RandomStringUtils;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.RegistryHelper;
|
||||||
|
+import org.bukkit.support.environment.VanillaFeature;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+import org.junit.jupiter.params.ParameterizedTest;
|
+import org.junit.jupiter.params.ParameterizedTest;
|
||||||
+import org.junit.jupiter.params.provider.EnumSource;
|
+import org.junit.jupiter.params.provider.EnumSource;
|
||||||
@ -5863,7 +5864,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import static org.junit.jupiter.api.Assertions.assertThrows;
|
+import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
+
|
+
|
||||||
+class AdventureCodecsTest extends AbstractTestingBase {
|
+@VanillaFeature
|
||||||
|
+class AdventureCodecsTest {
|
||||||
+
|
+
|
||||||
+ static final String PARAMETERIZED_NAME = "[{index}] {displayName}: {arguments}";
|
+ static final String PARAMETERIZED_NAME = "[{index}] {displayName}: {arguments}";
|
||||||
+
|
+
|
||||||
@ -5995,7 +5997,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ JavaOps.INSTANCE,
|
+ JavaOps.INSTANCE,
|
||||||
+ JsonOps.INSTANCE
|
+ JsonOps.INSTANCE
|
||||||
+ )
|
+ )
|
||||||
+ .map(ops -> AbstractTestingBase.REGISTRY_CUSTOM.createSerializationContext(ops))
|
+ .map(ops -> RegistryHelper.getRegistry().createSerializationContext(ops))
|
||||||
+ .toList();
|
+ .toList();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -6202,10 +6204,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||||
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
+
|
+
|
||||||
|
+@AllFeatures
|
||||||
+public class ComponentServicesTest {
|
+public class ComponentServicesTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
|
@ -2721,38 +2721,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+package io.papermc.paper.command.brigadier;
|
+package io.papermc.paper.command.brigadier;
|
||||||
+
|
+
|
||||||
+import com.mojang.brigadier.CommandDispatcher;
|
+import com.mojang.brigadier.CommandDispatcher;
|
||||||
+import com.mojang.brigadier.ResultConsumer;
|
|
||||||
+import com.mojang.brigadier.context.CommandContext;
|
|
||||||
+import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
+import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
+import com.mojang.brigadier.suggestion.Suggestions;
|
+import com.mojang.brigadier.suggestion.Suggestions;
|
||||||
+import com.mojang.brigadier.tree.CommandNode;
|
|
||||||
+import io.papermc.paper.command.brigadier.bukkit.BukkitBrigForwardingMap;
|
+import io.papermc.paper.command.brigadier.bukkit.BukkitBrigForwardingMap;
|
||||||
+import net.minecraft.server.MinecraftServer;
|
+import java.util.List;
|
||||||
+import net.minecraft.world.flag.FeatureFlags;
|
+import java.util.Map;
|
||||||
+import org.apache.logging.log4j.core.util.Assert;
|
|
||||||
+import org.bukkit.Bukkit;
|
+import org.bukkit.Bukkit;
|
||||||
+import org.bukkit.Location;
|
+import org.bukkit.Location;
|
||||||
+import org.bukkit.World;
|
|
||||||
+import org.bukkit.command.Command;
|
+import org.bukkit.command.Command;
|
||||||
+import org.bukkit.command.CommandMap;
|
+import org.bukkit.command.CommandMap;
|
||||||
+import org.bukkit.command.CommandSender;
|
+import org.bukkit.command.CommandSender;
|
||||||
+import org.bukkit.command.SimpleCommandMap;
|
+import org.bukkit.command.SimpleCommandMap;
|
||||||
+import org.bukkit.craftbukkit.command.CraftCommandMap;
|
+import org.bukkit.support.RegistryHelper;
|
||||||
+import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.bukkit.entity.Entity;
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.bukkit.plugin.PluginManager;
|
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
|
||||||
+import org.jetbrains.annotations.NotNull;
|
+import org.jetbrains.annotations.NotNull;
|
||||||
+import org.jetbrains.annotations.Nullable;
|
|
||||||
+import org.junit.jupiter.api.Assertions;
|
+import org.junit.jupiter.api.Assertions;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+import org.mockito.Mockito;
|
+import org.mockito.Mockito;
|
||||||
+
|
+
|
||||||
+import java.util.List;
|
+@Normal
|
||||||
+import java.util.Map;
|
+public class BukkitCommandConversionTest {
|
||||||
+import java.util.logging.Logger;
|
|
||||||
+
|
|
||||||
+public class BukkitCommandConversionTest extends AbstractTestingBase {
|
|
||||||
+
|
+
|
||||||
+ private CommandSender getSender() {
|
+ private CommandSender getSender() {
|
||||||
+ return Mockito.mock(CommandSender.class);
|
+ return Mockito.mock(CommandSender.class);
|
||||||
@ -2764,7 +2753,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ CommandSourceStack object = Mockito.mock(CommandSourceStack.class);
|
+ CommandSourceStack object = Mockito.mock(CommandSourceStack.class);
|
||||||
+ Mockito.when(object.getLocation()).thenReturn(new Location(null, 0, 0, 0));;
|
+ Mockito.when(object.getLocation()).thenReturn(new Location(null, 0, 0, 0));;
|
||||||
+
|
+
|
||||||
+ CommandDispatcher dispatcher = DATA_PACK.commands.getDispatcher();
|
+ CommandDispatcher dispatcher = RegistryHelper.getDataPack().commands.getDispatcher();
|
||||||
+ dispatcher.setConsumer((context, success, result) -> {});
|
+ dispatcher.setConsumer((context, success, result) -> {});
|
||||||
+ CommandMap commandMap = new SimpleCommandMap(Bukkit.getServer(), new BukkitBrigForwardingMap());
|
+ CommandMap commandMap = new SimpleCommandMap(Bukkit.getServer(), new BukkitBrigForwardingMap());
|
||||||
+ Map<String, Command> stringCommandMap = commandMap.getKnownCommands();
|
+ Map<String, Command> stringCommandMap = commandMap.getKnownCommands();
|
||||||
@ -2831,16 +2820,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
diff --git a/src/test/java/org/bukkit/support/DummyServerHelper.java b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
--- a/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
+++ b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
@@ -0,0 +0,0 @@ public final class DummyServer {
|
@@ -0,0 +0,0 @@ public final class DummyServerHelper {
|
||||||
|
// Paper start - testing additions
|
||||||
final Thread currentThread = Thread.currentThread();
|
final Thread currentThread = Thread.currentThread();
|
||||||
when(instance.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread));
|
when(instance.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread));
|
||||||
|
|
||||||
- final org.bukkit.plugin.PluginManager pluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(instance, new org.bukkit.command.SimpleCommandMap(instance), null);
|
- final org.bukkit.plugin.PluginManager pluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(instance, new org.bukkit.command.SimpleCommandMap(instance), null);
|
||||||
+ final org.bukkit.plugin.PluginManager pluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(instance, new org.bukkit.command.SimpleCommandMap(instance, new java.util.HashMap<>()), null); // Paper
|
+ final org.bukkit.plugin.PluginManager pluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(instance, new org.bukkit.command.SimpleCommandMap(instance, new java.util.HashMap<>()), null);
|
||||||
when(instance.getPluginManager()).thenReturn(pluginManager);
|
when(instance.getPluginManager()).thenReturn(pluginManager);
|
||||||
// paper end - testing additions
|
// Paper end - testing additions
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- exclude(group = "org.apache.logging.log4j", module = "log4j-api")
|
- exclude(group = "org.apache.logging.log4j", module = "log4j-api")
|
||||||
- }
|
- }
|
||||||
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
|
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
|
||||||
implementation("org.ow2.asm:asm-commons:9.7")
|
implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||||
implementation("commons-lang:commons-lang:2.6")
|
implementation("commons-lang:commons-lang:2.6")
|
||||||
runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
|
runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
|
||||||
@@ -0,0 +0,0 @@ tasks.jar {
|
@@ -0,0 +0,0 @@ tasks.jar {
|
||||||
@ -57,8 +57,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+// Paper end
|
+// Paper end
|
||||||
+
|
+
|
||||||
tasks.test {
|
tasks.test {
|
||||||
exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
|
include("**/**TestSuite.class")
|
||||||
useJUnitPlatform()
|
workingDir = temporaryDir
|
||||||
@@ -0,0 +0,0 @@ tasks.registerRunTask("runReobf") {
|
@@ -0,0 +0,0 @@ tasks.registerRunTask("runReobf") {
|
||||||
tasks.registerRunTask("runDev") {
|
tasks.registerRunTask("runDev") {
|
||||||
description = "Spin up a non-relocated Mojang-mapped test server"
|
description = "Spin up a non-relocated Mojang-mapped test server"
|
||||||
@ -142,7 +142,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper
|
+ Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper
|
||||||
|
|
||||||
Calendar deadline = Calendar.getInstance();
|
Calendar deadline = Calendar.getInstance();
|
||||||
deadline.add(Calendar.DAY_OF_YEAR, -14);
|
deadline.add(Calendar.DAY_OF_YEAR, -28);
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||||
@ -171,15 +171,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ "pack_format": 41
|
+ "pack_format": 41
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
diff --git a/src/test/java/org/bukkit/support/RegistryHelper.java b/src/test/java/org/bukkit/support/RegistryHelper.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
--- a/src/test/java/org/bukkit/support/RegistryHelper.java
|
||||||
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
+++ b/src/test/java/org/bukkit/support/RegistryHelper.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public final class RegistryHelper {
|
||||||
public static final Registry<Biome> BIOMES;
|
}
|
||||||
|
|
||||||
static {
|
public static void setup(FeatureFlagSet featureFlagSet) {
|
||||||
+ System.setProperty("Paper.pushPaperAssetsRoot", "true"); // Paper
|
+ System.setProperty("Paper.pushPaperAssetsRoot", "true"); // Paper - build system changes - push asset root
|
||||||
SharedConstants.tryDetectVersion();
|
SharedConstants.tryDetectVersion();
|
||||||
Bootstrap.bootStrap();
|
Bootstrap.bootStrap();
|
||||||
// Populate available packs
|
|
||||||
|
@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -0,0 +0,0 @@ dependencies {
|
@@ -0,0 +0,0 @@ dependencies {
|
||||||
testImplementation("org.mockito:mockito-core:5.11.0")
|
testImplementation("org.mockito:mockito-core:5.14.1")
|
||||||
testImplementation("org.ow2.asm:asm-tree:9.7")
|
testImplementation("org.ow2.asm:asm-tree:9.7.1")
|
||||||
testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
|
testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
|
||||||
+ implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling
|
+ implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling
|
||||||
}
|
}
|
||||||
|
@ -671,7 +671,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public static boolean useConsole = true;
|
public static boolean useConsole = true;
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class Main {
|
@@ -0,0 +0,0 @@ public class Main {
|
||||||
deadline.add(Calendar.DAY_OF_YEAR, -14);
|
deadline.add(Calendar.DAY_OF_YEAR, -28);
|
||||||
if (buildDate.before(deadline.getTime())) {
|
if (buildDate.before(deadline.getTime())) {
|
||||||
System.err.println("*** Error, this build is outdated ***");
|
System.err.println("*** Error, this build is outdated ***");
|
||||||
- System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");
|
- System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");
|
||||||
|
@ -118,8 +118,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
@Overridden
|
@Overridden
|
||||||
boolean isEmpty() {
|
boolean isEmpty() {
|
||||||
- return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null);
|
- return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasJukeboxPlayable() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null);
|
||||||
+ return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper
|
+ return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasJukeboxPlayable() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paper start
|
// Paper start
|
||||||
|
@ -90,6 +90,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import net.minecraft.world.entity.EquipmentSlot;
|
+import net.minecraft.world.entity.EquipmentSlot;
|
||||||
+import org.bukkit.craftbukkit.CraftEquipmentSlot;
|
+import org.bukkit.craftbukkit.CraftEquipmentSlot;
|
||||||
+import org.bukkit.inventory.EquipmentSlotGroup;
|
+import org.bukkit.inventory.EquipmentSlotGroup;
|
||||||
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.params.ParameterizedTest;
|
+import org.junit.jupiter.params.ParameterizedTest;
|
||||||
+import org.junit.jupiter.params.provider.EnumSource;
|
+import org.junit.jupiter.params.provider.EnumSource;
|
||||||
+import org.junit.jupiter.params.provider.MethodSource;
|
+import org.junit.jupiter.params.provider.MethodSource;
|
||||||
@ -97,6 +98,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
+
|
+
|
||||||
|
+@Normal
|
||||||
+class EquipmentSlotGroupTest {
|
+class EquipmentSlotGroupTest {
|
||||||
+
|
+
|
||||||
+ static List<EquipmentSlotGroup> apiValues() throws ReflectiveOperationException {
|
+ static List<EquipmentSlotGroup> apiValues() throws ReflectiveOperationException {
|
||||||
|
@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public void addToCraftingManager() {
|
public void addToCraftingManager() {
|
||||||
ItemStack result = this.getResult();
|
ItemStack result = this.getResult();
|
||||||
|
|
||||||
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy
|
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false), CraftItemStack.asNMSCopy(result), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy
|
||||||
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false), CraftItemStack.asNMSCopy(result), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy & support empty RecipeChoice
|
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false), CraftItemStack.asNMSCopy(result), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy & support empty RecipeChoice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addToCraftingManager() {
|
public void addToCraftingManager() {
|
||||||
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy
|
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy
|
||||||
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy & support empty RecipeChoice
|
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy & support empty RecipeChoice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,13 +76,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import java.util.Iterator;
|
+import java.util.Iterator;
|
||||||
+import org.bukkit.Bukkit;
|
+import org.bukkit.Bukkit;
|
||||||
+import org.bukkit.inventory.Recipe;
|
+import org.bukkit.inventory.Recipe;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
+
|
+
|
||||||
+class TestRecipeChoice extends AbstractTestingBase {
|
+@AllFeatures
|
||||||
|
+class TestRecipeChoice {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
+ void testRecipeChoices() {
|
+ void testRecipeChoices() {
|
||||||
@ -95,22 +96,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ assertTrue(foundRecipes, "No recipes found!");
|
+ assertTrue(foundRecipes, "No recipes found!");
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
diff --git a/src/test/java/org/bukkit/support/DummyServerHelper.java b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
--- a/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
+++ b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
@@ -0,0 +0,0 @@ public final class DummyServer {
|
@@ -0,0 +0,0 @@ public final class DummyServerHelper {
|
||||||
when(instance.getPluginManager()).thenReturn(pluginManager);
|
// Paper end - testing additions
|
||||||
// paper end - testing additions
|
|
||||||
|
|
||||||
+ // Paper start - add test for recipe conversion
|
io.papermc.paper.configuration.GlobalConfigTestingBase.setupGlobalConfigForTest(); // Paper - configuration files - setup global configuration test base
|
||||||
+ when(instance.recipeIterator()).thenAnswer(ignored -> {
|
|
||||||
+ return com.google.common.collect.Iterators.transform(
|
|
||||||
+ AbstractTestingBase.DATA_PACK.getRecipeManager().byType.entries().iterator(),
|
|
||||||
+ input -> input.getValue().toBukkitRecipe());
|
|
||||||
+ });
|
|
||||||
+ // Paper end - add test for recipe conversion
|
|
||||||
+
|
+
|
||||||
Bukkit.setServer(instance);
|
+ // Paper start - add test for recipe conversion
|
||||||
} catch (Throwable t) {
|
+ when(instance.recipeIterator()).thenAnswer(ignored ->
|
||||||
throw new Error(t);
|
+ com.google.common.collect.Iterators.transform(
|
||||||
|
+ RegistryHelper.getDataPack().getRecipeManager().byType.entries().iterator(),
|
||||||
|
+ input -> input.getValue().toBukkitRecipe()
|
||||||
|
+ )
|
||||||
|
+ );
|
||||||
|
+ // Paper end - add test for recipe conversion
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -36,11 +36,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import org.bukkit.entity.TropicalFish;
|
+import org.bukkit.entity.TropicalFish;
|
||||||
+import org.bukkit.inventory.ItemStack;
|
+import org.bukkit.inventory.ItemStack;
|
||||||
+import org.bukkit.inventory.meta.TropicalFishBucketMeta;
|
+import org.bukkit.inventory.meta.TropicalFishBucketMeta;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.junit.jupiter.api.Assertions;
|
+import org.junit.jupiter.api.Assertions;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+public class CraftMetaTropicalFishBucketTest extends AbstractTestingBase {
|
+@AllFeatures
|
||||||
|
+public class CraftMetaTropicalFishBucketTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
+ public void testAllCombinations() {
|
+ public void testAllCombinations() {
|
||||||
|
@ -70,13 +70,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import java.util.ArrayList;
|
+import java.util.ArrayList;
|
||||||
+import java.util.List;
|
+import java.util.List;
|
||||||
+import java.util.stream.Stream;
|
+import java.util.stream.Stream;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.params.ParameterizedTest;
|
+import org.junit.jupiter.params.ParameterizedTest;
|
||||||
+import org.junit.jupiter.params.provider.MethodSource;
|
+import org.junit.jupiter.params.provider.MethodSource;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.fail;
|
+import static org.junit.jupiter.api.Assertions.fail;
|
||||||
+
|
+
|
||||||
+public class EntitySetItemSlotSilentOverrideTest extends AbstractTestingBase {
|
+@Normal
|
||||||
|
+public class EntitySetItemSlotSilentOverrideTest {
|
||||||
+
|
+
|
||||||
+ public static Stream<ClassInfo> parameters() {
|
+ public static Stream<ClassInfo> parameters() {
|
||||||
+ final List<ClassInfo> classInfo = new ArrayList<>();
|
+ final List<ClassInfo> classInfo = new ArrayList<>();
|
||||||
|
@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
@@ -0,0 +0,0 @@ public class Main {
|
@@ -0,0 +0,0 @@ public class Main {
|
||||||
Calendar deadline = Calendar.getInstance();
|
Calendar deadline = Calendar.getInstance();
|
||||||
deadline.add(Calendar.DAY_OF_YEAR, -14);
|
deadline.add(Calendar.DAY_OF_YEAR, -28);
|
||||||
if (buildDate.before(deadline.getTime())) {
|
if (buildDate.before(deadline.getTime())) {
|
||||||
- System.err.println("*** Error, this build is outdated ***");
|
- System.err.println("*** Error, this build is outdated ***");
|
||||||
+ // Paper start - This is some stupid bullshit
|
+ // Paper start - This is some stupid bullshit
|
||||||
|
@ -467,9 +467,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
+import net.minecraft.world.level.block.entity.BlockEntityType;
|
+import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.support.AbstractTestingBase;
|
import org.bukkit.support.environment.AllFeatures;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@@ -0,0 +0,0 @@ public class BlockStateTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class BlockStateTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,6 +171,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
final Material material;
|
final Material material;
|
||||||
- private CraftBlockEntityState<?> blockEntityTag;
|
- private CraftBlockEntityState<?> blockEntityTag;
|
||||||
|
- private BlockVector position;
|
||||||
+ // Paper start - store data separately
|
+ // Paper start - store data separately
|
||||||
+ DataComponentMap components;
|
+ DataComponentMap components;
|
||||||
+ CustomData blockEntityTag;
|
+ CustomData blockEntityTag;
|
||||||
@ -204,6 +205,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ this.components = te.components;
|
+ this.components = te.components;
|
||||||
this.blockEntityTag = te.blockEntityTag;
|
this.blockEntityTag = te.blockEntityTag;
|
||||||
|
- this.position = te.position;
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,14 +213,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
super(tag, extraHandledDcts); // Paper
|
super(tag, extraHandledDcts); // Paper
|
||||||
this.material = material;
|
this.material = material;
|
||||||
|
|
||||||
|
- getOrEmpty(tag, CraftMetaBlockState.BLOCK_ENTITY_TAG).ifPresent((blockTag) -> {
|
||||||
|
- CompoundTag nbt = blockTag.copyTag();
|
||||||
+ // Paper start - move to separate method to be re-called
|
+ // Paper start - move to separate method to be re-called
|
||||||
+ this.updateBlockState(tag);
|
+ this.updateBlockState(tag);
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
|
- this.blockEntityTag = CraftMetaBlockState.getBlockState(material, nbt);
|
||||||
|
- if (nbt.contains("x", CraftMagicNumbers.NBT.TAG_ANY_NUMBER) && nbt.contains("y", CraftMagicNumbers.NBT.TAG_ANY_NUMBER) && nbt.contains("z", CraftMagicNumbers.NBT.TAG_ANY_NUMBER)) {
|
||||||
|
- this.position = new BlockVector(nbt.getInt("x"), nbt.getInt("y"), nbt.getInt("z"));
|
||||||
|
- }
|
||||||
+ private void updateBlockState(final DataComponentPatch tag) {
|
+ private void updateBlockState(final DataComponentPatch tag) {
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
getOrEmpty(tag, CraftMetaBlockState.BLOCK_ENTITY_TAG).ifPresent((nbt) -> {
|
+ getOrEmpty(tag, CraftMetaBlockState.BLOCK_ENTITY_TAG).ifPresent((nbt) -> {
|
||||||
- this.blockEntityTag = CraftMetaBlockState.getBlockState(material, nbt.copyTag());
|
|
||||||
+ this.blockEntityTag = nbt; // Paper
|
+ this.blockEntityTag = nbt; // Paper
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -271,13 +278,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.setBlockState(CraftMetaBlockState.getBlockState(this.material, this.internalTag)); // Paper - general item meta fixes - pass through setter
|
+ this.setBlockState(CraftMetaBlockState.getBlockState(this.material, this.internalTag)); // Paper - general item meta fixes - pass through setter
|
||||||
this.internalTag = null;
|
this.internalTag = null;
|
||||||
}
|
}
|
||||||
|
- this.position = SerializableMeta.getObject(BlockVector.class, map, "blockPosition", true);
|
||||||
|
+ // Paper start - general item meta fixes - parse spigot legacy position and merge into block entity tag
|
||||||
|
+ final BlockVector legacyPosition = SerializableMeta.getObject(BlockVector.class, map, "blockPosition", true);
|
||||||
|
+ if (legacyPosition != null) {
|
||||||
|
+ this.blockEntityTag = this.blockEntityTag.update(t -> {
|
||||||
|
+ if (t.isEmpty()) {
|
||||||
|
+ BlockEntity.addEntityType(t, java.util.Objects.requireNonNull(CraftBlockStates.getBlockEntityType(this.materialForBlockEntityType())));
|
||||||
|
+ }
|
||||||
|
+ t.putInt("x", legacyPosition.getBlockX());
|
||||||
|
+ t.putInt("y", legacyPosition.getBlockY());
|
||||||
|
+ t.putInt("z", legacyPosition.getBlockZ());
|
||||||
|
+ });
|
||||||
|
+ }
|
||||||
|
+ // Paper end - general item meta fixes - parse spigot legacy position and merge into block entity tag
|
||||||
}
|
}
|
||||||
@@ -0,0 +0,0 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
|
|
||||||
|
@Override
|
||||||
void applyToItem(CraftMetaItem.Applicator tag) {
|
void applyToItem(CraftMetaItem.Applicator tag) {
|
||||||
super.applyToItem(tag);
|
super.applyToItem(tag);
|
||||||
|
|
||||||
|
- CompoundTag nbt = null;
|
||||||
- if (this.blockEntityTag != null) {
|
- if (this.blockEntityTag != null) {
|
||||||
- tag.put(CraftMetaBlockState.BLOCK_ENTITY_TAG, CustomData.of(this.blockEntityTag.getSnapshotNBTWithoutComponents()));
|
- nbt = this.blockEntityTag.getItemNBT();
|
||||||
|
-
|
||||||
|
- for (TypedDataComponent<?> component : this.blockEntityTag.collectComponents()) {
|
||||||
|
- tag.putIfAbsent(component);
|
||||||
|
- }
|
||||||
+ // Paper start - accurately replicate logic for creating ItemStack from BlockEntity
|
+ // Paper start - accurately replicate logic for creating ItemStack from BlockEntity
|
||||||
+ // taken from BlockEntity#saveToItem and BlockItem#setBlockEntityData
|
+ // taken from BlockEntity#saveToItem and BlockItem#setBlockEntityData
|
||||||
+ final CompoundTag nbt = this.blockEntityTag.copyTag();
|
+ final CompoundTag nbt = this.blockEntityTag.copyTag();
|
||||||
@ -286,11 +313,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ } else if (!nbt.isEmpty()) {
|
+ } else if (!nbt.isEmpty()) {
|
||||||
+ BlockEntity.addEntityType(nbt, java.util.Objects.requireNonNull(CraftBlockStates.getBlockEntityType(this.materialForBlockEntityType())));
|
+ BlockEntity.addEntityType(nbt, java.util.Objects.requireNonNull(CraftBlockStates.getBlockEntityType(this.materialForBlockEntityType())));
|
||||||
+ tag.put(CraftMetaBlockState.BLOCK_ENTITY_TAG, CustomData.of(nbt));
|
+ tag.put(CraftMetaBlockState.BLOCK_ENTITY_TAG, CustomData.of(nbt));
|
||||||
+ }
|
}
|
||||||
|
|
||||||
- for (TypedDataComponent<?> component : this.blockEntityTag.collectComponents()) {
|
- if (this.position != null) {
|
||||||
- tag.putIfAbsent(component);
|
- if (nbt == null) {
|
||||||
|
- nbt = new CompoundTag();
|
||||||
- }
|
- }
|
||||||
|
-
|
||||||
|
- nbt.putInt("x", this.position.getBlockX());
|
||||||
|
- nbt.putInt("y", this.position.getBlockY());
|
||||||
|
- nbt.putInt("z", this.position.getBlockZ());
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (nbt != null && !nbt.isEmpty()) {
|
||||||
|
- CraftBlockEntityState<?> tile = (this.blockEntityTag != null) ? this.blockEntityTag : CraftMetaBlockState.getBlockState(this.material, null);
|
||||||
|
- // See ItemBlock#setBlockEntityData
|
||||||
|
- tile.addEntityType(nbt);
|
||||||
|
-
|
||||||
|
- tag.put(CraftMetaBlockState.BLOCK_ENTITY_TAG, CustomData.of(nbt));
|
||||||
+ for (final TypedDataComponent<?> component : this.components) {
|
+ for (final TypedDataComponent<?> component : this.components) {
|
||||||
+ if (CraftMetaItem.DEFAULT_HANDLED_DCTS.contains(component.type())) continue; // if the component type was already handled by CraftMetaItem, don't add it again
|
+ if (CraftMetaItem.DEFAULT_HANDLED_DCTS.contains(component.type())) continue; // if the component type was already handled by CraftMetaItem, don't add it again
|
||||||
+ tag.builder.set(component);
|
+ tag.builder.set(component);
|
||||||
@ -308,10 +348,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper start - new serialization format
|
+ // Paper start - new serialization format
|
||||||
+ if (tag.contains(CraftMetaBlockState.BLOCK_ENTITY_TAG_CUSTOM_DATA.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
|
+ if (tag.contains(CraftMetaBlockState.BLOCK_ENTITY_TAG_CUSTOM_DATA.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
|
||||||
+ this.blockEntityTag = CustomData.of(tag.getCompound(CraftMetaBlockState.BLOCK_ENTITY_TAG_CUSTOM_DATA.NBT));
|
+ this.blockEntityTag = CustomData.of(tag.getCompound(CraftMetaBlockState.BLOCK_ENTITY_TAG_CUSTOM_DATA.NBT));
|
||||||
}
|
+ }
|
||||||
+ if (tag.contains(CraftMetaBlockState.BLOCK_ENTITY_COMPONENTS.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
|
+ if (tag.contains(CraftMetaBlockState.BLOCK_ENTITY_COMPONENTS.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
|
||||||
+ this.components = DataComponentMap.CODEC.parse(org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry().createSerializationContext(net.minecraft.nbt.NbtOps.INSTANCE), tag.getCompound(CraftMetaBlockState.BLOCK_ENTITY_COMPONENTS.NBT)).getOrThrow();
|
+ this.components = DataComponentMap.CODEC.parse(org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry().createSerializationContext(net.minecraft.nbt.NbtOps.INSTANCE), tag.getCompound(CraftMetaBlockState.BLOCK_ENTITY_COMPONENTS.NBT)).getOrThrow();
|
||||||
+ }
|
}
|
||||||
+ // Paper end - new serialization format
|
+ // Paper end - new serialization format
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,15 +362,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper start - new serialization format
|
+ // Paper start - new serialization format
|
||||||
+ if (!this.blockEntityTag.isEmpty()) {
|
+ if (!this.blockEntityTag.isEmpty()) {
|
||||||
+ internalTags.put(CraftMetaBlockState.BLOCK_ENTITY_TAG_CUSTOM_DATA.NBT, this.blockEntityTag.getUnsafe()); // unsafe because it's serialized right away
|
+ internalTags.put(CraftMetaBlockState.BLOCK_ENTITY_TAG_CUSTOM_DATA.NBT, this.blockEntityTag.getUnsafe()); // unsafe because it's serialized right away
|
||||||
+ }
|
}
|
||||||
+ if (!this.components.isEmpty()) {
|
+ if (!this.components.isEmpty()) {
|
||||||
+ final Tag componentsTag = DataComponentMap.CODEC.encodeStart(org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry().createSerializationContext(net.minecraft.nbt.NbtOps.INSTANCE), this.components).getOrThrow();
|
+ final Tag componentsTag = DataComponentMap.CODEC.encodeStart(org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry().createSerializationContext(net.minecraft.nbt.NbtOps.INSTANCE), this.components).getOrThrow();
|
||||||
+ internalTags.put(CraftMetaBlockState.BLOCK_ENTITY_COMPONENTS.NBT, componentsTag);
|
+ internalTags.put(CraftMetaBlockState.BLOCK_ENTITY_COMPONENTS.NBT, componentsTag);
|
||||||
}
|
+ }
|
||||||
+ // Paper end - new serialization format
|
+ // Paper end - new serialization format
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
ImmutableMap.Builder<String, Object> serialize(ImmutableMap.Builder<String, Object> builder) {
|
||||||
|
super.serialize(builder);
|
||||||
|
builder.put("blockMaterial", this.material.name());
|
||||||
|
- if (this.position != null) {
|
||||||
|
- builder.put("blockPosition", this.position);
|
||||||
|
- }
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
|
@@ -0,0 +0,0 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
|
||||||
int applyHash() {
|
int applyHash() {
|
||||||
final int original;
|
final int original;
|
||||||
@ -338,6 +387,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- if (this.blockEntityTag != null) {
|
- if (this.blockEntityTag != null) {
|
||||||
- hash = 61 * hash + this.blockEntityTag.hashCode();
|
- hash = 61 * hash + this.blockEntityTag.hashCode();
|
||||||
- }
|
- }
|
||||||
|
- if (this.position != null) {
|
||||||
|
- hash = 61 * hash + this.position.hashCode();
|
||||||
|
- }
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ hash = 61 * hash + this.blockEntityTag.hashCode();
|
+ hash = 61 * hash + this.blockEntityTag.hashCode();
|
||||||
+ hash = 61 * hash + this.components.hashCode();
|
+ hash = 61 * hash + this.components.hashCode();
|
||||||
@ -349,21 +401,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
if (meta instanceof CraftMetaBlockState) {
|
if (meta instanceof CraftMetaBlockState) {
|
||||||
CraftMetaBlockState that = (CraftMetaBlockState) meta;
|
CraftMetaBlockState that = (CraftMetaBlockState) meta;
|
||||||
|
|
||||||
- return Objects.equal(this.blockEntityTag, that.blockEntityTag);
|
- return Objects.equal(this.blockEntityTag, that.blockEntityTag) && Objects.equal(this.position, that.position);
|
||||||
+ return Objects.equal(this.blockEntityTag, that.blockEntityTag) && Objects.equal(this.components, that.components); // Paper
|
+ return Objects.equal(this.blockEntityTag, that.blockEntityTag) && Objects.equal(this.components, that.components); // Paper
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isBlockStateEmpty() {
|
||||||
|
- return !(this.blockEntityTag != null || this.position != null);
|
||||||
|
+ return !(this.blockEntityTag != null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean notUncommon(CraftMetaItem meta) {
|
boolean notUncommon(CraftMetaItem meta) {
|
||||||
- return super.notUncommon(meta) && (meta instanceof CraftMetaBlockState || this.blockEntityTag == null);
|
- return super.notUncommon(meta) && (meta instanceof CraftMetaBlockState || this.isBlockStateEmpty());
|
||||||
+ return super.notUncommon(meta) && (meta instanceof CraftMetaBlockState || (this.blockEntityTag.isEmpty() && this.components.isEmpty())); // Paper
|
+ return super.notUncommon(meta) && (meta instanceof CraftMetaBlockState || (this.blockEntityTag.isEmpty() && this.components.isEmpty())); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean isEmpty() {
|
boolean isEmpty() {
|
||||||
- return super.isEmpty() && this.blockEntityTag == null;
|
- return super.isEmpty() && this.isBlockStateEmpty();
|
||||||
+ return super.isEmpty() && this.blockEntityTag.isEmpty() && this.components.isEmpty(); // Paper
|
+ return super.isEmpty() && this.blockEntityTag.isEmpty() && this.components.isEmpty(); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,6 +430,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- if (this.blockEntityTag != null) {
|
- if (this.blockEntityTag != null) {
|
||||||
- meta.blockEntityTag = this.blockEntityTag.copy();
|
- meta.blockEntityTag = this.blockEntityTag.copy();
|
||||||
- }
|
- }
|
||||||
|
- if (this.position != null) {
|
||||||
|
- meta.position = this.position.clone();
|
||||||
|
- }
|
||||||
+ // Paper start - no need for "clone" because they are essentially immutables
|
+ // Paper start - no need for "clone" because they are essentially immutables
|
||||||
+ meta.blockEntityTag = this.blockEntityTag;
|
+ meta.blockEntityTag = this.blockEntityTag;
|
||||||
+ meta.components = this.components;
|
+ meta.components = this.components;
|
||||||
@ -1053,6 +1113,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
itemTag.put(CraftMetaItem.DAMAGE, this.damage);
|
itemTag.put(CraftMetaItem.DAMAGE, this.damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
|
}
|
||||||
|
|
||||||
|
void applyEnchantments(Map<Enchantment, Integer> enchantments, CraftMetaItem.Applicator tag, ItemMetaKeyType<ItemEnchantments> key, ItemFlag itemFlag) {
|
||||||
|
- if (enchantments == null && !this.hasItemFlag(itemFlag)) {
|
||||||
|
+ if (enchantments == null /*&& !this.hasItemFlag(itemFlag)*/) { // Paper - general item meta fixes - only emit enchantment component if enchantments are defined
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1070,7 +1139,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
@Overridden
|
@Overridden
|
||||||
boolean isEmpty() {
|
boolean isEmpty() {
|
||||||
- return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper
|
- return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasJukeboxPlayable() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper
|
||||||
+ return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasJukeboxPlayable() || this.hasDamageValue() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper
|
+ return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasJukeboxPlayable() || this.hasDamageValue() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1551,7 +1620,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// Invalid colour
|
// Invalid colour
|
||||||
}
|
}
|
||||||
@@ -0,0 +0,0 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
|
@@ -0,0 +0,0 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
|
||||||
super.applyToItem(tag);
|
}
|
||||||
|
|
||||||
Optional<Holder<Potion>> defaultPotion = (this.hasBasePotionType()) ? Optional.of(CraftPotionType.bukkitToMinecraftHolder(this.type)) : Optional.empty();
|
Optional<Holder<Potion>> defaultPotion = (this.hasBasePotionType()) ? Optional.of(CraftPotionType.bukkitToMinecraftHolder(this.type)) : Optional.empty();
|
||||||
- Optional<Integer> potionColor = (this.hasColor()) ? Optional.of(this.color.asRGB()) : Optional.empty();
|
- Optional<Integer> potionColor = (this.hasColor()) ? Optional.of(this.color.asRGB()) : Optional.empty();
|
||||||
@ -2035,7 +2104,7 @@ diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCu
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java
|
--- a/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java
|
||||||
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java
|
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java
|
||||||
@@ -0,0 +0,0 @@ public class DeprecatedItemMetaCustomValueTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class DeprecatedItemMetaCustomValueTest {
|
||||||
public void testNBTTagStoring() {
|
public void testNBTTagStoring() {
|
||||||
CraftMetaItem itemMeta = this.createComplexItemMeta();
|
CraftMetaItem itemMeta = this.createComplexItemMeta();
|
||||||
|
|
||||||
@ -2048,7 +2117,7 @@ diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContai
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java
|
--- a/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java
|
||||||
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java
|
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java
|
||||||
@@ -0,0 +0,0 @@ public class PersistentDataContainerTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class PersistentDataContainerTest {
|
||||||
public void testNBTTagStoring() {
|
public void testNBTTagStoring() {
|
||||||
CraftMetaItem itemMeta = this.createComplexItemMeta();
|
CraftMetaItem itemMeta = this.createComplexItemMeta();
|
||||||
|
|
||||||
@ -2057,7 +2126,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
itemMeta.applyToItem(compound);
|
itemMeta.applyToItem(compound);
|
||||||
|
|
||||||
assertEquals(itemMeta, new CraftMetaItem(compound.build(), null)); // Paper
|
assertEquals(itemMeta, new CraftMetaItem(compound.build(), null)); // Paper
|
||||||
@@ -0,0 +0,0 @@ public class PersistentDataContainerTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class PersistentDataContainerTest {
|
||||||
assertEquals(List.of(), container.get(PersistentDataContainerTest.requestKey("list"), PersistentDataType.LIST.strings()));
|
assertEquals(List.of(), container.get(PersistentDataContainerTest.requestKey("list"), PersistentDataType.LIST.strings()));
|
||||||
|
|
||||||
// Write and read the entire container to NBT
|
// Write and read the entire container to NBT
|
||||||
|
@ -116,7 +116,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import org.bukkit.attribute.AttributeInstance;
|
+import org.bukkit.attribute.AttributeInstance;
|
||||||
+import org.bukkit.attribute.AttributeModifier;
|
+import org.bukkit.attribute.AttributeModifier;
|
||||||
+import org.bukkit.entity.EntityType;
|
+import org.bukkit.entity.EntityType;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertFalse;
|
+import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
@ -124,12 +124,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import static org.junit.jupiter.api.Assertions.assertThrows;
|
+import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
+
|
+
|
||||||
+public class EntityTypeAttributesTest extends AbstractTestingBase {
|
+@AllFeatures
|
||||||
|
+public class EntityTypeAttributesTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
+ public void testIllegalEntity() {
|
+ public void testIllegalEntity() {
|
||||||
+ assertFalse(EntityType.EGG.hasDefaultAttributes());
|
+ assertFalse(EntityType.EGG.hasDefaultAttributes());
|
||||||
+ assertThrows(IllegalArgumentException.class, () -> EntityType.EGG.getDefaultAttributes());
|
+ assertThrows(IllegalArgumentException.class, EntityType.EGG::getDefaultAttributes);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
|
@ -28,8 +28,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import joptsimple.OptionSet;
|
import joptsimple.OptionSet;
|
||||||
import joptsimple.OptionSpec;
|
import joptsimple.OptionSpec;
|
||||||
@@ -0,0 +0,0 @@ public class Commodore {
|
@@ -0,0 +0,0 @@ public class Commodore {
|
||||||
private static final Map<String, RerouteMethodData> METHOD_REROUTE = Commodore.createReroutes(MethodRerouting.class);
|
return this.reroutes;
|
||||||
private static final Map<String, RerouteMethodData> ENUM_METHOD_REROUTE = Commodore.createReroutes(EnumEvil.class);
|
}
|
||||||
|
|
||||||
+ // Paper start - Plugin rewrites
|
+ // Paper start - Plugin rewrites
|
||||||
+ private static final Map<String, String> SEARCH_AND_REMOVE = initReplacementsMap();
|
+ private static final Map<String, String> SEARCH_AND_REMOVE = initReplacementsMap();
|
||||||
|
@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
+ testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
|
+ testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||||
|
testImplementation("org.junit.platform:junit-platform-suite-engine:1.10.0")
|
||||||
testImplementation("org.hamcrest:hamcrest:2.2")
|
testImplementation("org.hamcrest:hamcrest:2.2")
|
||||||
testImplementation("org.mockito:mockito-core:5.11.0")
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
|
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
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
|
@ -64,7 +64,7 @@ diff --git a/src/test/java/org/bukkit/registry/PerRegistryTest.java b/src/test/j
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/registry/PerRegistryTest.java
|
--- a/src/test/java/org/bukkit/registry/PerRegistryTest.java
|
||||||
+++ b/src/test/java/org/bukkit/registry/PerRegistryTest.java
|
+++ b/src/test/java/org/bukkit/registry/PerRegistryTest.java
|
||||||
@@ -0,0 +0,0 @@ public class PerRegistryTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class PerRegistryTest {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("data")
|
@MethodSource("data")
|
||||||
@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
this.assertSameMatchWithKeyMessage(registry, element, key.toString()); // namespace:key
|
this.assertSameMatchWithKeyMessage(registry, element, key.toString()); // namespace:key
|
||||||
this.assertSameMatchWithKeyMessage(registry, element, key.getKey()); // key
|
this.assertSameMatchWithKeyMessage(registry, element, key.getKey()); // key
|
||||||
@@ -0,0 +0,0 @@ public class PerRegistryTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class PerRegistryTest {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,10 +82,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import java.util.Map;
|
+import java.util.Map;
|
||||||
+import java.util.Set;
|
+import java.util.Set;
|
||||||
+import net.minecraft.world.entity.EntityEvent;
|
+import net.minecraft.world.entity.EntityEvent;
|
||||||
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.fail;
|
+import static org.junit.jupiter.api.Assertions.fail;
|
||||||
+
|
+
|
||||||
|
+@Normal
|
||||||
+public class EntityEffectTest {
|
+public class EntityEffectTest {
|
||||||
+
|
+
|
||||||
+ private static List<Byte> collectNmsLevelEvents() throws ReflectiveOperationException {
|
+ private static List<Byte> collectNmsLevelEvents() throws ReflectiveOperationException {
|
||||||
|
@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
- float javaVersion = Float.parseFloat(System.getProperty("java.class.version"));
|
- float javaVersion = Float.parseFloat(System.getProperty("java.class.version"));
|
||||||
- if (javaVersion > 66.0) {
|
- if (javaVersion > 67.0) {
|
||||||
- System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 22 is supported.");
|
- System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 23 is supported.");
|
||||||
- return;
|
- return;
|
||||||
+ // Paper start - Improve java version check
|
+ // Paper start - Improve java version check
|
||||||
+ boolean skip = Boolean.getBoolean("Paper.IgnoreJavaVersion");
|
+ boolean skip = Boolean.getBoolean("Paper.IgnoreJavaVersion");
|
||||||
|
@ -33,14 +33,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+import org.bukkit.Material;
|
+import org.bukkit.Material;
|
||||||
+import org.bukkit.inventory.ItemStack;
|
+import org.bukkit.inventory.ItemStack;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.VanillaFeature;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertFalse;
|
+import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
+import static org.junit.jupiter.api.Assertions.assertThrows;
|
|
||||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
+
|
+
|
||||||
+public class ItemStackRepairCheckTest extends AbstractTestingBase {
|
+@VanillaFeature
|
||||||
|
+public class ItemStackRepairCheckTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
+ public void testIsRepariableBy() {
|
+ public void testIsRepariableBy() {
|
||||||
|
@ -23006,18 +23006,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system
|
+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateFutures(ChunkMap chunkLoadingManager, Executor executor) {
|
|
||||||
- FullChunkStatus fullchunkstatus = ChunkLevel.fullStatus(this.oldTicketLevel);
|
|
||||||
- FullChunkStatus fullchunkstatus1 = ChunkLevel.fullStatus(this.ticketLevel);
|
|
||||||
- boolean flag = fullchunkstatus.isOrAfter(FullChunkStatus.FULL);
|
|
||||||
- boolean flag1 = fullchunkstatus1.isOrAfter(FullChunkStatus.FULL);
|
|
||||||
- // CraftBukkit start
|
- // CraftBukkit start
|
||||||
- // ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins.
|
- // ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins.
|
||||||
- if (flag && !flag1) {
|
- // SPIGOT-7780: Moved out of updateFutures to call all chunk unload events before calling updateHighestAllowedStatus for all chunks
|
||||||
|
- protected void callEventIfUnloading(ChunkMap playerchunkmap) {
|
||||||
|
- FullChunkStatus oldFullChunkStatus = ChunkLevel.fullStatus(this.oldTicketLevel);
|
||||||
|
- FullChunkStatus newFullChunkStatus = ChunkLevel.fullStatus(this.ticketLevel);
|
||||||
|
- boolean oldIsFull = oldFullChunkStatus.isOrAfter(FullChunkStatus.FULL);
|
||||||
|
- boolean newIsFull = newFullChunkStatus.isOrAfter(FullChunkStatus.FULL);
|
||||||
|
- if (oldIsFull && !newIsFull) {
|
||||||
- this.getFullChunkFuture().thenAccept((either) -> {
|
- this.getFullChunkFuture().thenAccept((either) -> {
|
||||||
- LevelChunk chunk = (LevelChunk) either.orElse(null);
|
- LevelChunk chunk = (LevelChunk) either.orElse(null);
|
||||||
- if (chunk != null) {
|
- if (chunk != null) {
|
||||||
- chunkLoadingManager.callbackExecutor.execute(() -> {
|
- playerchunkmap.callbackExecutor.execute(() -> {
|
||||||
- // Minecraft will apply the chunks tick lists to the world once the chunk got loaded, and then store the tick
|
- // Minecraft will apply the chunks tick lists to the world once the chunk got loaded, and then store the tick
|
||||||
- // lists again inside the chunk once the chunk becomes inaccessible and set the chunk's needsSaving flag.
|
- // lists again inside the chunk once the chunk becomes inaccessible and set the chunk's needsSaving flag.
|
||||||
- // These actions may however happen deferred, so we manually set the needsSaving flag already here.
|
- // These actions may however happen deferred, so we manually set the needsSaving flag already here.
|
||||||
@ -23032,9 +23033,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- });
|
- });
|
||||||
-
|
-
|
||||||
- // Run callback right away if the future was already done
|
- // Run callback right away if the future was already done
|
||||||
- chunkLoadingManager.callbackExecutor.run();
|
- playerchunkmap.callbackExecutor.run();
|
||||||
|
- }
|
||||||
- }
|
- }
|
||||||
- // CraftBukkit end
|
- // CraftBukkit end
|
||||||
|
-
|
||||||
|
protected void updateFutures(ChunkMap chunkLoadingManager, Executor executor) {
|
||||||
|
- FullChunkStatus fullchunkstatus = ChunkLevel.fullStatus(this.oldTicketLevel);
|
||||||
|
- FullChunkStatus fullchunkstatus1 = ChunkLevel.fullStatus(this.ticketLevel);
|
||||||
|
- boolean flag = fullchunkstatus.isOrAfter(FullChunkStatus.FULL);
|
||||||
|
- boolean flag1 = fullchunkstatus1.isOrAfter(FullChunkStatus.FULL);
|
||||||
-
|
-
|
||||||
- this.wasAccessibleSinceLastSave |= flag1;
|
- this.wasAccessibleSinceLastSave |= flag1;
|
||||||
- if (!flag && flag1) {
|
- if (!flag && flag1) {
|
||||||
@ -24412,6 +24420,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
- if (!this.chunksToUpdateFutures.isEmpty()) {
|
- if (!this.chunksToUpdateFutures.isEmpty()) {
|
||||||
|
- // CraftBukkit start - SPIGOT-7780: Call chunk unload events before updateHighestAllowedStatus
|
||||||
|
- this.chunksToUpdateFutures.forEach((playerchunk) -> {
|
||||||
|
- playerchunk.callEventIfUnloading(chunkLoadingManager);
|
||||||
|
- });
|
||||||
|
- // CraftBukkit end
|
||||||
- this.chunksToUpdateFutures.forEach((playerchunk) -> {
|
- this.chunksToUpdateFutures.forEach((playerchunk) -> {
|
||||||
- playerchunk.updateHighestAllowedStatus(chunkLoadingManager);
|
- playerchunk.updateHighestAllowedStatus(chunkLoadingManager);
|
||||||
- });
|
- });
|
||||||
|
@ -72,11 +72,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import net.minecraft.world.effect.MobEffectCategory;
|
+import net.minecraft.world.effect.MobEffectCategory;
|
||||||
+import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
|
+import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
|
||||||
+import org.bukkit.potion.PotionEffectType;
|
+import org.bukkit.potion.PotionEffectType;
|
||||||
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
+
|
+
|
||||||
|
+@AllFeatures
|
||||||
+public class EffectCategoryTest {
|
+public class EffectCategoryTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
|
@ -547,27 +547,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
|
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
|
||||||
if (LingeringPotion.class.isAssignableFrom(projectile)) {
|
if (LingeringPotion.class.isAssignableFrom(projectile)) {
|
||||||
launch = new net.minecraft.world.entity.projectile.ThrownPotion(world, this.getHandle());
|
launch = new net.minecraft.world.entity.projectile.ThrownPotion(world, this.getHandle());
|
||||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
||||||
launch = new net.minecraft.world.entity.projectile.WitherSkull(world, this.getHandle(), vec);
|
|
||||||
} else if (DragonFireball.class.isAssignableFrom(projectile)) {
|
|
||||||
launch = new net.minecraft.world.entity.projectile.DragonFireball(world, this.getHandle(), vec);
|
|
||||||
- } else if (WindCharge.class.isAssignableFrom(projectile)) {
|
|
||||||
- launch = EntityType.WIND_CHARGE.create(world);
|
|
||||||
- ((net.minecraft.world.entity.projectile.windcharge.WindCharge) launch).setOwner(this.getHandle());
|
|
||||||
- ((net.minecraft.world.entity.projectile.windcharge.WindCharge) launch).assignDirectionalMovement(vec, 0.1D);
|
|
||||||
+ // Paper start - more projectile API - correctly launch wind charges
|
|
||||||
+ } else if (org.bukkit.entity.AbstractWindCharge.class.isAssignableFrom(projectile)) {
|
|
||||||
+ if (org.bukkit.entity.BreezeWindCharge.class.isAssignableFrom(projectile)) {
|
|
||||||
+ launch = EntityType.BREEZE_WIND_CHARGE.create(world);
|
|
||||||
+ } else {
|
|
||||||
+ launch = EntityType.WIND_CHARGE.create(world);
|
|
||||||
+ }
|
|
||||||
+ ((net.minecraft.world.entity.projectile.windcharge.AbstractWindCharge) launch).setOwner(this.getHandle());
|
|
||||||
+ ((net.minecraft.world.entity.projectile.windcharge.AbstractWindCharge) launch).shootFromRotation(this.getHandle(), this.getHandle().getXRot(), this.getHandle().getYRot(), 0.0F, 1.5F, 1.0F); // Paper - copied from net.minecraft.world.item.WindChargeItem.use
|
|
||||||
+ // Paper end - more projectile API - correctly launch wind charges
|
|
||||||
} else {
|
|
||||||
launch = new LargeFireball(world, this.getHandle(), vec, 1);
|
|
||||||
}
|
|
||||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
} else if (Firework.class.isAssignableFrom(projectile)) {
|
} else if (Firework.class.isAssignableFrom(projectile)) {
|
||||||
Location location = this.getEyeLocation();
|
Location location = this.getEyeLocation();
|
||||||
@ -880,116 +859,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity, java.util.function.Consumer<? super T> function) {
|
+ public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity, java.util.function.Consumer<? super T> function) {
|
||||||
+ // Paper end - launchProjectile consumer
|
+ // Paper end - launchProjectile consumer
|
||||||
Preconditions.checkArgument(this.getBlock().getType() == Material.DISPENSER, "Block is no longer dispenser");
|
Preconditions.checkArgument(this.getBlock().getType() == Material.DISPENSER, "Block is no longer dispenser");
|
||||||
- // Copied from BlockDispenser.dispense()
|
+
|
||||||
- BlockSource sourceblock = new BlockSource((ServerLevel) this.dispenserBlock.getLevel(), this.dispenserBlock.getBlockPos(), this.dispenserBlock.getBlockState(), this.dispenserBlock);
|
// Copied from BlockDispenser.dispense()
|
||||||
- // Copied from DispenseBehaviorProjectile
|
BlockSource sourceblock = new BlockSource((ServerLevel) this.dispenserBlock.getLevel(), this.dispenserBlock.getBlockPos(), this.dispenserBlock.getBlockState(), this.dispenserBlock);
|
||||||
- Position iposition = DispenserBlock.getDispensePosition(sourceblock);
|
// Copied from DispenseBehaviorProjectile
|
||||||
- Direction enumdirection = (Direction) sourceblock.state().getValue(DispenserBlock.FACING);
|
@@ -0,0 +0,0 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
||||||
- net.minecraft.world.level.Level world = this.dispenserBlock.getLevel();
|
} else if (Fireball.class.isAssignableFrom(projectile)) {
|
||||||
- net.minecraft.world.entity.Entity launch = null;
|
if (AbstractWindCharge.class.isAssignableFrom(projectile)) {
|
||||||
|
item = Items.WIND_CHARGE;
|
||||||
+ // Paper start - rewrite whole method to match ProjectileDispenseBehavior
|
|
||||||
+ net.minecraft.world.item.Item item = null;
|
|
||||||
if (Snowball.class.isAssignableFrom(projectile)) {
|
|
||||||
- launch = new net.minecraft.world.entity.projectile.Snowball(world, iposition.x(), iposition.y(), iposition.z());
|
|
||||||
+ item = net.minecraft.world.item.Items.SNOWBALL;
|
|
||||||
} else if (Egg.class.isAssignableFrom(projectile)) {
|
|
||||||
- launch = new ThrownEgg(world, iposition.x(), iposition.y(), iposition.z());
|
|
||||||
- } else if (EnderPearl.class.isAssignableFrom(projectile)) {
|
|
||||||
- launch = new ThrownEnderpearl(world, null);
|
|
||||||
- launch.setPos(iposition.x(), iposition.y(), iposition.z());
|
|
||||||
+ item = net.minecraft.world.item.Items.EGG;
|
|
||||||
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
|
|
||||||
- launch = new ThrownExperienceBottle(world, iposition.x(), iposition.y(), iposition.z());
|
|
||||||
+ item = net.minecraft.world.item.Items.EXPERIENCE_BOTTLE;
|
|
||||||
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
|
|
||||||
if (LingeringPotion.class.isAssignableFrom(projectile)) {
|
|
||||||
- launch = new net.minecraft.world.entity.projectile.ThrownPotion(world, iposition.x(), iposition.y(), iposition.z());
|
|
||||||
- ((net.minecraft.world.entity.projectile.ThrownPotion) launch).setItem(CraftItemStack.asNMSCopy(new ItemStack(org.bukkit.Material.LINGERING_POTION, 1)));
|
|
||||||
+ item = net.minecraft.world.item.Items.LINGERING_POTION;
|
|
||||||
} else {
|
|
||||||
- launch = new net.minecraft.world.entity.projectile.ThrownPotion(world, iposition.x(), iposition.y(), iposition.z());
|
|
||||||
- ((net.minecraft.world.entity.projectile.ThrownPotion) launch).setItem(CraftItemStack.asNMSCopy(new ItemStack(org.bukkit.Material.SPLASH_POTION, 1)));
|
|
||||||
+ item = net.minecraft.world.item.Items.SPLASH_POTION;
|
|
||||||
}
|
|
||||||
} else if (AbstractArrow.class.isAssignableFrom(projectile)) {
|
|
||||||
- if (TippedArrow.class.isAssignableFrom(projectile)) {
|
|
||||||
- launch = new net.minecraft.world.entity.projectile.Arrow(world, iposition.x(), iposition.y(), iposition.z(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW), null);
|
|
||||||
- ((Arrow) launch.getBukkitEntity()).setBasePotionType(PotionType.WATER);
|
|
||||||
- } else if (SpectralArrow.class.isAssignableFrom(projectile)) {
|
|
||||||
- launch = new net.minecraft.world.entity.projectile.SpectralArrow(world, iposition.x(), iposition.y(), iposition.z(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.SPECTRAL_ARROW), null);
|
|
||||||
+ if (SpectralArrow.class.isAssignableFrom(projectile)) {
|
|
||||||
+ item = net.minecraft.world.item.Items.SPECTRAL_ARROW;
|
|
||||||
} else {
|
|
||||||
- launch = new net.minecraft.world.entity.projectile.Arrow(world, iposition.x(), iposition.y(), iposition.z(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW), null);
|
|
||||||
- }
|
|
||||||
- ((net.minecraft.world.entity.projectile.AbstractArrow) launch).pickup = net.minecraft.world.entity.projectile.AbstractArrow.Pickup.ALLOWED;
|
|
||||||
- ((net.minecraft.world.entity.projectile.AbstractArrow) launch).projectileSource = this;
|
|
||||||
- } else if (Fireball.class.isAssignableFrom(projectile)) {
|
|
||||||
- double d0 = iposition.x() + (double) ((float) enumdirection.getStepX() * 0.3F);
|
|
||||||
- double d1 = iposition.y() + (double) ((float) enumdirection.getStepY() * 0.3F);
|
|
||||||
- double d2 = iposition.z() + (double) ((float) enumdirection.getStepZ() * 0.3F);
|
|
||||||
- RandomSource random = world.random;
|
|
||||||
- double d3 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepX();
|
|
||||||
- double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepY();
|
|
||||||
- double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepZ();
|
|
||||||
-
|
|
||||||
- if (SmallFireball.class.isAssignableFrom(projectile)) {
|
|
||||||
- launch = new net.minecraft.world.entity.projectile.SmallFireball(world, null, new Vec3(d0, d1, d2));
|
|
||||||
- } else if (WitherSkull.class.isAssignableFrom(projectile)) {
|
|
||||||
- launch = EntityType.WITHER_SKULL.create(world);
|
|
||||||
- launch.setPos(d0, d1, d2);
|
|
||||||
-
|
|
||||||
- ((AbstractHurtingProjectile) launch).assignDirectionalMovement(new Vec3(d3, d4, d5), 0.1D);
|
|
||||||
- } else {
|
- } else {
|
||||||
- launch = EntityType.FIREBALL.create(world);
|
+ } else if (org.bukkit.entity.SmallFireball.class.isAssignableFrom(projectile)) { // Paper - more projectile API - only allow firing fire charges.
|
||||||
- launch.setPos(d0, d1, d2);
|
item = Items.FIRE_CHARGE;
|
||||||
-
|
|
||||||
- ((AbstractHurtingProjectile) launch).assignDirectionalMovement(new Vec3(d3, d4, d5), 0.1D);
|
|
||||||
+ item = net.minecraft.world.item.Items.ARROW;
|
|
||||||
}
|
}
|
||||||
+ } else if (org.bukkit.entity.WindCharge.class.isAssignableFrom(projectile)) {
|
} else if (Firework.class.isAssignableFrom(projectile)) {
|
||||||
+ item = net.minecraft.world.item.Items.WIND_CHARGE;
|
@@ -0,0 +0,0 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
||||||
+ } else if (org.bukkit.entity.Firework.class.isAssignableFrom(projectile)) {
|
Position iposition = dispenseConfig.positionFunction().getDispensePosition(sourceblock, enumdirection);
|
||||||
+ item = net.minecraft.world.item.Items.FIREWORK_ROCKET;
|
net.minecraft.world.entity.projectile.Projectile launch = projectileItem.asProjectile(world, iposition, itemstack, enumdirection);
|
||||||
+ } else if (SmallFireball.class.isAssignableFrom(projectile)) {
|
|
||||||
+ item = net.minecraft.world.item.Items.FIRE_CHARGE;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- ((AbstractHurtingProjectile) launch).projectileSource = this;
|
- if (Fireball.class.isAssignableFrom(projectile)) {
|
||||||
+ if (!(item instanceof net.minecraft.world.item.ProjectileItem projectileItem)) {
|
+ if (false && Fireball.class.isAssignableFrom(projectile)) { // Paper - more project API - dispensers cannot launch anything but fire charges.
|
||||||
+ throw new IllegalArgumentException("Projectile '%s' is not supported".formatted(projectile.getSimpleName()));
|
AbstractHurtingProjectile customFireball = null;
|
||||||
|
if (WitherSkull.class.isAssignableFrom(projectile)) {
|
||||||
|
launch = customFireball = EntityType.WITHER_SKULL.create(world);
|
||||||
|
@@ -0,0 +0,0 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- Preconditions.checkArgument(launch != null, "Projectile not supported");
|
- if (launch instanceof net.minecraft.world.entity.projectile.AbstractArrow arrow) {
|
||||||
+ net.minecraft.world.item.ProjectileItem.DispenseConfig config = projectileItem.createDispenseConfig();
|
+ if (false && launch instanceof net.minecraft.world.entity.projectile.AbstractArrow arrow) { // Paper - more projectile API - this is set by the respective ArrowItem when constructing the projectile
|
||||||
+ net.minecraft.world.level.block.state.BlockState state = this.dispenserBlock.getBlockState();
|
arrow.pickup = net.minecraft.world.entity.projectile.AbstractArrow.Pickup.ALLOWED;
|
||||||
+ net.minecraft.world.level.Level world = this.dispenserBlock.getLevel();
|
}
|
||||||
+ BlockSource pointer = new BlockSource((ServerLevel) world, this.dispenserBlock.getBlockPos(), state, this.dispenserBlock); // copied from DispenseBlock#dispenseFrom
|
launch.projectileSource = this;
|
||||||
+ Direction facing = state.getValue(DispenserBlock.FACING);
|
@@ -0,0 +0,0 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
||||||
+ Position pos = config.positionFunction().getDispensePosition(pointer, facing);
|
|
||||||
|
|
||||||
- if (launch instanceof net.minecraft.world.entity.projectile.Projectile) {
|
|
||||||
- if (launch instanceof ThrowableProjectile) {
|
|
||||||
- ((ThrowableProjectile) launch).projectileSource = this;
|
|
||||||
- }
|
|
||||||
- // Values from DispenseBehaviorProjectile
|
|
||||||
- float a = 6.0F;
|
|
||||||
- float b = 1.1F;
|
|
||||||
- if (launch instanceof net.minecraft.world.entity.projectile.ThrownPotion || launch instanceof ThrownExpBottle) {
|
|
||||||
- // Values from respective DispenseBehavior classes
|
|
||||||
- a *= 0.5F;
|
|
||||||
- b *= 1.25F;
|
|
||||||
- }
|
|
||||||
- // Copied from DispenseBehaviorProjectile
|
|
||||||
- ((net.minecraft.world.entity.projectile.Projectile) launch).shoot((double) enumdirection.getStepX(), (double) ((float) enumdirection.getStepY() + 0.1F), (double) enumdirection.getStepZ(), b, a);
|
|
||||||
- }
|
|
||||||
+ net.minecraft.world.entity.projectile.Projectile launch = projectileItem.asProjectile(world, pos, new net.minecraft.world.item.ItemStack(item), facing);
|
|
||||||
+ // some projectile are not shoot and doesn't rely on the config for power/uncertainty
|
|
||||||
+ projectileItem.shoot(launch, facing.getStepX(), facing.getStepY(), facing.getStepZ(), config.power(), config.uncertainty());
|
|
||||||
+ launch.projectileSource = this;
|
|
||||||
+ // Paper end
|
|
||||||
|
|
||||||
if (velocity != null) {
|
if (velocity != null) {
|
||||||
((T) launch.getBukkitEntity()).setVelocity(velocity);
|
((T) launch.getBukkitEntity()).setVelocity(velocity);
|
||||||
}
|
}
|
||||||
|
@ -108,8 +108,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public void addToCraftingManager() {
|
public void addToCraftingManager() {
|
||||||
ItemStack result = this.getResult();
|
ItemStack result = this.getResult();
|
||||||
|
|
||||||
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result))));
|
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false), CraftItemStack.asNMSCopy(result))));
|
||||||
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy
|
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false), CraftItemStack.asNMSCopy(result), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java
|
||||||
@ -137,7 +137,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addToCraftingManager() {
|
public void addToCraftingManager() {
|
||||||
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true))));
|
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false))));
|
||||||
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy
|
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7532,12 +7532,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+import io.papermc.paper.plugin.entrypoint.dependency.MetaDependencyTree;
|
+import io.papermc.paper.plugin.entrypoint.dependency.MetaDependencyTree;
|
||||||
+import io.papermc.paper.plugin.entrypoint.dependency.SimpleMetaDependencyTree;
|
+import io.papermc.paper.plugin.entrypoint.dependency.SimpleMetaDependencyTree;
|
||||||
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import java.util.List;
|
+import java.util.List;
|
||||||
+
|
+
|
||||||
+import static org.hamcrest.MatcherAssert.assertThat;
|
+import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
+
|
+
|
||||||
|
+@Normal
|
||||||
+public class PluginDependencyValidationTest {
|
+public class PluginDependencyValidationTest {
|
||||||
+
|
+
|
||||||
+ private static final TestPluginMeta MAIN;
|
+ private static final TestPluginMeta MAIN;
|
||||||
@ -7602,6 +7604,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import io.papermc.paper.plugin.entrypoint.strategy.modern.ModernPluginLoadingStrategy;
|
+import io.papermc.paper.plugin.entrypoint.strategy.modern.ModernPluginLoadingStrategy;
|
||||||
+import io.papermc.paper.plugin.entrypoint.strategy.ProviderConfiguration;
|
+import io.papermc.paper.plugin.entrypoint.strategy.ProviderConfiguration;
|
||||||
+import io.papermc.paper.plugin.provider.PluginProvider;
|
+import io.papermc.paper.plugin.provider.PluginProvider;
|
||||||
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.api.Assertions;
|
+import org.junit.jupiter.api.Assertions;
|
||||||
+import org.junit.jupiter.api.BeforeEach;
|
+import org.junit.jupiter.api.BeforeEach;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
@ -7612,6 +7615,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import java.util.Map;
|
+import java.util.Map;
|
||||||
+import java.util.concurrent.atomic.AtomicInteger;
|
+import java.util.concurrent.atomic.AtomicInteger;
|
||||||
+
|
+
|
||||||
|
+@Normal
|
||||||
+public class PluginLoadOrderTest {
|
+public class PluginLoadOrderTest {
|
||||||
+
|
+
|
||||||
+ private static List<PluginProvider<PaperTestPlugin>> REGISTERED_PROVIDERS = new ArrayList<>();
|
+ private static List<PluginProvider<PaperTestPlugin>> REGISTERED_PROVIDERS = new ArrayList<>();
|
||||||
@ -7754,14 +7758,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import org.bukkit.event.Event;
|
+import org.bukkit.event.Event;
|
||||||
+import org.bukkit.permissions.Permission;
|
+import org.bukkit.permissions.Permission;
|
||||||
+import org.bukkit.plugin.PluginManager;
|
+import org.bukkit.plugin.PluginManager;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.api.AfterEach;
|
+import org.junit.jupiter.api.AfterEach;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import static org.hamcrest.MatcherAssert.assertThat;
|
+import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
+import static org.hamcrest.Matchers.*;
|
+import static org.hamcrest.Matchers.empty;
|
||||||
|
+import static org.hamcrest.Matchers.is;
|
||||||
|
+import static org.hamcrest.Matchers.nullValue;
|
||||||
+
|
+
|
||||||
+public class PluginManagerTest extends AbstractTestingBase {
|
+@Normal
|
||||||
|
+public class PluginManagerTest {
|
||||||
+
|
+
|
||||||
+ private static final PluginManager pm = Bukkit.getPluginManager();
|
+ private static final PluginManager pm = Bukkit.getPluginManager();
|
||||||
+
|
+
|
||||||
@ -7832,9 +7839,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+package io.papermc.paper.plugin;
|
+package io.papermc.paper.plugin;
|
||||||
+
|
+
|
||||||
+import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta;
|
+import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta;
|
||||||
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.api.Assertions;
|
+import org.junit.jupiter.api.Assertions;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
|
+@Normal
|
||||||
+public class PluginNamingTest {
|
+public class PluginNamingTest {
|
||||||
+ private static final String TEST_NAME = "Test_Plugin";
|
+ private static final String TEST_NAME = "Test_Plugin";
|
||||||
+ private static final String TEST_VERSION = "1.0";
|
+ private static final String TEST_VERSION = "1.0";
|
||||||
@ -7870,9 +7879,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import org.bukkit.event.Event;
|
+import org.bukkit.event.Event;
|
||||||
+import org.bukkit.event.EventHandler;
|
+import org.bukkit.event.EventHandler;
|
||||||
+import org.bukkit.event.Listener;
|
+import org.bukkit.event.Listener;
|
||||||
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.api.Assertions;
|
+import org.junit.jupiter.api.Assertions;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
|
+@Normal
|
||||||
+public class SyntheticEventTest {
|
+public class SyntheticEventTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
@ -8142,16 +8153,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ return "null";
|
+ return "null";
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
diff --git a/src/test/java/org/bukkit/support/DummyServerHelper.java b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
--- a/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
+++ b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
@@ -0,0 +0,0 @@ public final class DummyServer {
|
@@ -0,0 +0,0 @@ public final class DummyServerHelper {
|
||||||
|
// Paper start - testing additions
|
||||||
final Thread currentThread = Thread.currentThread();
|
final Thread currentThread = Thread.currentThread();
|
||||||
when(instance.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread));
|
when(instance.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread));
|
||||||
|
|
||||||
- final org.bukkit.plugin.PluginManager pluginManager = new org.bukkit.plugin.SimplePluginManager(instance, new org.bukkit.command.SimpleCommandMap(instance));
|
- final org.bukkit.plugin.PluginManager pluginManager = new org.bukkit.plugin.SimplePluginManager(instance, new org.bukkit.command.SimpleCommandMap(instance));
|
||||||
+ final org.bukkit.plugin.PluginManager pluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(instance, new org.bukkit.command.SimpleCommandMap(instance), null);
|
+ final org.bukkit.plugin.PluginManager pluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(instance, new org.bukkit.command.SimpleCommandMap(instance), null);
|
||||||
when(instance.getPluginManager()).thenReturn(pluginManager);
|
when(instance.getPluginManager()).thenReturn(pluginManager);
|
||||||
// paper end - testing additions
|
// Paper end - testing additions
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ dependencies {
|
@@ -0,0 +0,0 @@ dependencies {
|
||||||
implementation("jline:jline:2.12.1")
|
implementation("jline:jline:2.12.1")
|
||||||
implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
|
implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
|
||||||
implementation("org.ow2.asm:asm-commons:9.7")
|
implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||||
+ implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
|
+ implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
|
||||||
implementation("commons-lang:commons-lang:2.6")
|
implementation("commons-lang:commons-lang:2.6")
|
||||||
runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
|
runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
|
||||||
@ -5362,15 +5362,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
diff --git a/src/test/java/org/bukkit/support/DummyServerHelper.java b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
--- a/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
+++ b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public final class DummyServerHelper {
|
||||||
BIOMES = REGISTRY_CUSTOM.registryOrThrow(Registries.BIOME);
|
when(instance.getPluginManager()).thenReturn(pluginManager);
|
||||||
|
// Paper end - testing additions
|
||||||
DummyServer.setup();
|
|
||||||
+ io.papermc.paper.configuration.GlobalConfigTestingBase.setupGlobalConfigForTest(); // Paper
|
|
||||||
|
|
||||||
CraftRegistry.setMinecraftRegistry(REGISTRY_CUSTOM);
|
|
||||||
|
|
||||||
|
+ io.papermc.paper.configuration.GlobalConfigTestingBase.setupGlobalConfigForTest(); // Paper - configuration files - setup global configuration test base
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -0,0 +0,0 @@ dependencies {
|
@@ -0,0 +0,0 @@ dependencies {
|
||||||
testImplementation("org.ow2.asm:asm-tree:9.7")
|
testImplementation("org.ow2.asm:asm-tree:9.7.1")
|
||||||
testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
|
testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
|
||||||
implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling
|
implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling
|
||||||
+ implementation("net.neoforged:AutoRenamingTool:2.0.3") // Paper - remap plugins
|
+ implementation("net.neoforged:AutoRenamingTool:2.0.3") // Paper - remap plugins
|
||||||
|
@ -24,17 +24,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
blockList.setBlock(blockposition_mutableblockposition1, block.defaultBlockState(), 3);
|
blockList.setBlock(blockposition_mutableblockposition1, block.defaultBlockState(), 3);
|
||||||
@@ -0,0 +0,0 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
|
|
||||||
|
|
||||||
worldaccess.getLevel().getCraftServer().getPluginManager().callEvent(portalEvent);
|
|
||||||
if (!portalEvent.isCancelled()) {
|
|
||||||
+ // Paper start - Properly destroy placed blocks on the end platform
|
|
||||||
+ if (flag) {
|
|
||||||
+ for (org.bukkit.craftbukkit.block.CraftBlockState state : blockList.getList()) {
|
|
||||||
+ worldaccess.destroyBlock(state.getPosition(), true);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // Paper end - Properly destroy placed blocks on the end platform
|
|
||||||
blockList.updateList();
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
|
@ -123,13 +123,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import java.util.ArrayList;
|
+import java.util.ArrayList;
|
||||||
+import java.util.List;
|
+import java.util.List;
|
||||||
+import java.util.stream.Stream;
|
+import java.util.stream.Stream;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.Normal;
|
||||||
+import org.junit.jupiter.params.ParameterizedTest;
|
+import org.junit.jupiter.params.ParameterizedTest;
|
||||||
+import org.junit.jupiter.params.provider.MethodSource;
|
+import org.junit.jupiter.params.provider.MethodSource;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
+
|
+
|
||||||
+public class BlockPlayerDestroyOverrideTest extends AbstractTestingBase {
|
+@Normal
|
||||||
|
+public class BlockPlayerDestroyOverrideTest {
|
||||||
+
|
+
|
||||||
+ public static Stream<ClassInfo> parameters() {
|
+ public static Stream<ClassInfo> parameters() {
|
||||||
+ final List<ClassInfo> classInfo = new ArrayList<>();
|
+ final List<ClassInfo> classInfo = new ArrayList<>();
|
||||||
|
@ -233,7 +233,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import org.bukkit.Material;
|
+import org.bukkit.Material;
|
||||||
+import org.bukkit.configuration.ConfigurationSection;
|
+import org.bukkit.configuration.ConfigurationSection;
|
||||||
+import org.bukkit.inventory.ItemStack;
|
+import org.bukkit.inventory.ItemStack;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.VanillaFeature;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
@ -241,7 +241,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import static org.junit.jupiter.api.Assertions.assertNull;
|
+import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
+
|
+
|
||||||
+public abstract class ConfigurationSectionTest extends AbstractTestingBase {
|
+public abstract class ConfigurationSectionTest {
|
||||||
+ public abstract ConfigurationSection getConfigurationSection();
|
+ public abstract ConfigurationSection getConfigurationSection();
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
@ -291,7 +291,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+import org.bukkit.configuration.ConfigurationSection;
|
+import org.bukkit.configuration.ConfigurationSection;
|
||||||
+import org.bukkit.configuration.MemoryConfiguration;
|
+import org.bukkit.configuration.MemoryConfiguration;
|
||||||
|
+import org.bukkit.support.environment.Normal;
|
||||||
+
|
+
|
||||||
|
+@Normal
|
||||||
+public class MemorySectionTest extends ConfigurationSectionTest {
|
+public class MemorySectionTest extends ConfigurationSectionTest {
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public ConfigurationSection getConfigurationSection() {
|
+ public ConfigurationSection getConfigurationSection() {
|
||||||
|
@ -946,6 +946,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
@@ -0,0 +0,0 @@ import net.kyori.adventure.key.Key;
|
||||||
import org.bukkit.Keyed;
|
import org.bukkit.Keyed;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.Registry;
|
import org.bukkit.Registry;
|
||||||
@ -1403,7 +1404,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import net.minecraft.core.Registry;
|
+import net.minecraft.core.Registry;
|
||||||
+import net.minecraft.resources.RegistryOps;
|
+import net.minecraft.resources.RegistryOps;
|
||||||
+import net.minecraft.resources.ResourceKey;
|
+import net.minecraft.resources.ResourceKey;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.RegistryHelper;
|
||||||
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.junit.jupiter.api.Disabled;
|
+import org.junit.jupiter.api.Disabled;
|
||||||
+import org.junit.jupiter.params.ParameterizedTest;
|
+import org.junit.jupiter.params.ParameterizedTest;
|
||||||
+import org.junit.jupiter.params.provider.Arguments;
|
+import org.junit.jupiter.params.provider.Arguments;
|
||||||
@ -1411,7 +1413,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
+
|
+
|
||||||
+class RegistryBuilderTest extends AbstractTestingBase {
|
+@AllFeatures
|
||||||
|
+class RegistryBuilderTest {
|
||||||
+
|
+
|
||||||
+ static List<Arguments> registries() {
|
+ static List<Arguments> registries() {
|
||||||
+ return List.of(
|
+ return List.of(
|
||||||
@ -1422,10 +1425,74 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ @ParameterizedTest
|
+ @ParameterizedTest
|
||||||
+ @MethodSource("registries")
|
+ @MethodSource("registries")
|
||||||
+ <M, T> void testEquality(final ResourceKey<? extends Registry<M>> resourceKey, final PaperRegistryBuilder.Filler<M, T, ?> filler) {
|
+ <M, T> void testEquality(final ResourceKey<? extends Registry<M>> resourceKey, final PaperRegistryBuilder.Filler<M, T, ?> filler) {
|
||||||
+ final Registry<M> registry = AbstractTestingBase.REGISTRY_CUSTOM.registryOrThrow(resourceKey);
|
+ final Registry<M> registry = RegistryHelper.getRegistry().registryOrThrow(resourceKey);
|
||||||
+ for (final Map.Entry<ResourceKey<M>, M> entry : registry.entrySet()) {
|
+ for (final Map.Entry<ResourceKey<M>, M> entry : registry.entrySet()) {
|
||||||
+ final M built = filler.fill(new Conversions(new RegistryOps.HolderLookupAdapter(AbstractTestingBase.REGISTRY_CUSTOM)), PaperRegistries.fromNms(entry.getKey()), entry.getValue()).build();
|
+ final M built = filler.fill(new Conversions(new RegistryOps.HolderLookupAdapter(RegistryHelper.getRegistry())), PaperRegistries.fromNms(entry.getKey()), entry.getValue()).build();
|
||||||
+ assertEquals(entry.getValue(), built);
|
+ assertEquals(entry.getValue(), built);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
|
diff --git a/src/test/java/org/bukkit/registry/RegistryClassTest.java b/src/test/java/org/bukkit/registry/RegistryClassTest.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/test/java/org/bukkit/registry/RegistryClassTest.java
|
||||||
|
+++ b/src/test/java/org/bukkit/registry/RegistryClassTest.java
|
||||||
|
@@ -0,0 +0,0 @@ public class RegistryClassTest {
|
||||||
|
outsideRequest.clear();
|
||||||
|
MockUtil.resetMock(spyRegistry);
|
||||||
|
doAnswer(invocation -> {
|
||||||
|
- Keyed item = realRegistry.get(invocation.getArgument(0));
|
||||||
|
+ Keyed item = realRegistry.get((NamespacedKey) invocation.getArgument(0)); // Paper - registry modification api - specifically call namespaced key overload
|
||||||
|
|
||||||
|
if (item == null) {
|
||||||
|
nullValue.add(invocation.getArgument(0));
|
||||||
|
@@ -0,0 +0,0 @@ public class RegistryClassTest {
|
||||||
|
nullAble.add(invocation.getArgument(0));
|
||||||
|
|
||||||
|
return item;
|
||||||
|
- }).when(spyRegistry).get(any());
|
||||||
|
+ }).when(spyRegistry).get((NamespacedKey) any()); // Paper - registry modification api - specifically call namespaced key overload
|
||||||
|
|
||||||
|
doAnswer(invocation -> {
|
||||||
|
- Keyed item = realRegistry.get(invocation.getArgument(0));
|
||||||
|
+ Keyed item = realRegistry.get((NamespacedKey) invocation.getArgument(0)); // Paper - registry modification api - specifically call namespaced key overload
|
||||||
|
|
||||||
|
if (item == null) {
|
||||||
|
nullValue.add(invocation.getArgument(0));
|
||||||
|
@@ -0,0 +0,0 @@ public class RegistryClassTest {
|
||||||
|
notNullAble.add(invocation.getArgument(0));
|
||||||
|
|
||||||
|
return item;
|
||||||
|
- }).when(spyRegistry).getOrThrow(any());
|
||||||
|
+ }).when(spyRegistry).getOrThrow((NamespacedKey) any()); // Paper - registry modification api - specifically call namespaced key overload
|
||||||
|
|
||||||
|
// Load class
|
||||||
|
try {
|
||||||
|
@@ -0,0 +0,0 @@ public class RegistryClassTest {
|
||||||
|
outsideRequest
|
||||||
|
.computeIfAbsent(type, ty -> new ArrayList<>()).add(invocation.getArgument(0));
|
||||||
|
return mock(type);
|
||||||
|
- }).when(spyRegistry).get(any());
|
||||||
|
+ }).when(spyRegistry).get((NamespacedKey) any()); // Paper - registry modification api - specifically call namespaced key overload
|
||||||
|
|
||||||
|
doAnswer(invocation -> {
|
||||||
|
outsideRequest
|
||||||
|
.computeIfAbsent(type, ty -> new ArrayList<>()).add(invocation.getArgument(0));
|
||||||
|
return mock(type);
|
||||||
|
- }).when(spyRegistry).getOrThrow(any());
|
||||||
|
+ }).when(spyRegistry).getOrThrow((NamespacedKey) any()); // Paper - registry modification api - specifically call namespaced key overload
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void initFieldDataCache() {
|
||||||
|
diff --git a/src/test/java/org/bukkit/support/extension/NormalExtension.java b/src/test/java/org/bukkit/support/extension/NormalExtension.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/test/java/org/bukkit/support/extension/NormalExtension.java
|
||||||
|
+++ b/src/test/java/org/bukkit/support/extension/NormalExtension.java
|
||||||
|
@@ -0,0 +0,0 @@ public class NormalExtension extends BaseExtension {
|
||||||
|
|
||||||
|
doAnswer(invocation ->
|
||||||
|
mocks.computeIfAbsent(invocation.getArgument(0), k -> mock(RegistryHelper.updateClass(keyed, invocation.getArgument(0)), withSettings().stubOnly().defaultAnswer(DEFAULT_ANSWER)))
|
||||||
|
- ).when(registry).get(any()); // Allow static classes to fill there fields, so that it does not error out, just by loading them
|
||||||
|
+ ).when(registry).get((NamespacedKey) any()); // Allow static classes to fill there fields, so that it does not error out, just by loading them // Paper - registry modification api - specifically call namespaced key overload
|
||||||
|
|
||||||
|
return registry;
|
||||||
|
}
|
||||||
|
@ -82,10 +82,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
|
|
||||||
-import net.minecraft.world.item.DyeColor;
|
-import net.minecraft.world.item.DyeColor;
|
||||||
import org.bukkit.support.AbstractTestingBase;
|
import org.bukkit.support.environment.Normal;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.EnumSource;
|
import org.junit.jupiter.params.provider.EnumSource;
|
||||||
@@ -0,0 +0,0 @@ public class DyeColorsTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class DyeColorsTest {
|
||||||
@EnumSource(DyeColor.class)
|
@EnumSource(DyeColor.class)
|
||||||
public void checkColor(DyeColor dye) {
|
public void checkColor(DyeColor dye) {
|
||||||
Color color = dye.getColor();
|
Color color = dye.getColor();
|
||||||
@ -94,7 +94,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
Color nmsColor = Color.fromARGB(nmsColorArray);
|
Color nmsColor = Color.fromARGB(nmsColorArray);
|
||||||
assertThat(color, is(nmsColor));
|
assertThat(color, is(nmsColor));
|
||||||
}
|
}
|
||||||
@@ -0,0 +0,0 @@ public class DyeColorsTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class DyeColorsTest {
|
||||||
@EnumSource(org.bukkit.DyeColor.class)
|
@EnumSource(org.bukkit.DyeColor.class)
|
||||||
public void checkFireworkColor(org.bukkit.DyeColor dye) {
|
public void checkFireworkColor(org.bukkit.DyeColor dye) {
|
||||||
Color color = dye.getFireworkColor();
|
Color color = dye.getFireworkColor();
|
||||||
@ -107,7 +107,7 @@ diff --git a/src/test/java/org/bukkit/ParticleTest.java b/src/test/java/org/bukk
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/ParticleTest.java
|
--- a/src/test/java/org/bukkit/ParticleTest.java
|
||||||
+++ b/src/test/java/org/bukkit/ParticleTest.java
|
+++ b/src/test/java/org/bukkit/ParticleTest.java
|
||||||
@@ -0,0 +0,0 @@ public class ParticleTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class ParticleTest {
|
||||||
Check in CraftParticle if the conversion is still correct.
|
Check in CraftParticle if the conversion is still correct.
|
||||||
""", bukkit.getKey()));
|
""", bukkit.getKey()));
|
||||||
|
|
||||||
@ -125,10 +125,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
-import net.minecraft.world.entity.EntityType;
|
-import net.minecraft.world.entity.EntityType;
|
||||||
import org.bukkit.support.AbstractTestingBase;
|
import org.bukkit.support.environment.AllFeatures;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class EntityTypesTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class EntityTypesTest {
|
||||||
public void testMaps() {
|
public void testMaps() {
|
||||||
Set<EntityType> allBukkit = Arrays.stream(EntityType.values()).filter((b) -> b.getName() != null).collect(Collectors.toSet());
|
Set<EntityType> allBukkit = Arrays.stream(EntityType.values()).filter((b) -> b.getName() != null).collect(Collectors.toSet());
|
||||||
|
|
||||||
@ -149,8 +149,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
-import net.minecraft.world.entity.animal.Panda;
|
-import net.minecraft.world.entity.animal.Panda;
|
||||||
import org.bukkit.craftbukkit.entity.CraftPanda;
|
import org.bukkit.craftbukkit.entity.CraftPanda;
|
||||||
|
import org.bukkit.support.environment.Normal;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class PandaGeneTest {
|
@@ -0,0 +0,0 @@ public class PandaGeneTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -175,7 +175,7 @@ diff --git a/src/test/java/org/bukkit/registry/RegistryConstantsTest.java b/src/
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
--- a/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
||||||
+++ b/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
+++ b/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
||||||
@@ -0,0 +0,0 @@ public class RegistryConstantsTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class RegistryConstantsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTrimMaterial() {
|
public void testTrimMaterial() {
|
||||||
@ -200,7 +200,7 @@ diff --git a/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java b/src/
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java
|
--- a/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java
|
||||||
+++ b/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java
|
+++ b/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java
|
||||||
@@ -0,0 +0,0 @@ public class RegistryLoadOrderTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class RegistryLoadOrderTest {
|
||||||
|
|
||||||
private static boolean initInterface = false;
|
private static boolean initInterface = false;
|
||||||
private static boolean initAbstract = false;
|
private static boolean initAbstract = false;
|
||||||
|
@ -649,7 +649,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||||
@@ -0,0 +0,0 @@ public class Commodore {
|
@@ -0,0 +0,0 @@ public class Commodore {
|
||||||
private static final Map<String, RerouteMethodData> ENUM_METHOD_REROUTE = Commodore.createReroutes(EnumEvil.class);
|
}
|
||||||
|
|
||||||
// Paper start - Plugin rewrites
|
// Paper start - Plugin rewrites
|
||||||
- private static final Map<String, String> SEARCH_AND_REMOVE = initReplacementsMap();
|
- private static final Map<String, String> SEARCH_AND_REMOVE = initReplacementsMap();
|
||||||
@ -711,10 +711,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ import org.bukkit.potion.PotionType;
|
@@ -0,0 +0,0 @@ import org.bukkit.potion.PotionType;
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public final class CraftMagicNumbers implements UnsafeValues {
|
public final class CraftMagicNumbers implements UnsafeValues {
|
||||||
public static final UnsafeValues INSTANCE = new CraftMagicNumbers();
|
public static final CraftMagicNumbers INSTANCE = new CraftMagicNumbers();
|
||||||
+ public static final boolean DISABLE_OLD_API_SUPPORT = Boolean.getBoolean("paper.disableOldApiSupport"); // Paper
|
+ public static final boolean DISABLE_OLD_API_SUPPORT = Boolean.getBoolean("paper.disableOldApiSupport"); // Paper
|
||||||
|
|
||||||
private CraftMagicNumbers() {}
|
private final Commodore commodore = new Commodore();
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||||
throw new InvalidPluginException("Plugin API version " + pdf.getAPIVersion() + " is lower than the minimum allowed version. Please update or replace it.");
|
throw new InvalidPluginException("Plugin API version " + pdf.getAPIVersion() + " is lower than the minimum allowed version. Please update or replace it.");
|
||||||
@ -736,5 +736,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
try {
|
try {
|
||||||
clazz = Commodore.convert(clazz, pdf.getName(), ApiVersion.getOrCreateVersion(pdf.getAPIVersion()), ((CraftServer) Bukkit.getServer()).activeCompatibilities);
|
clazz = this.commodore.convert(clazz, pdf.getName(), ApiVersion.getOrCreateVersion(pdf.getAPIVersion()), ((CraftServer) Bukkit.getServer()).activeCompatibilities);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") {
|
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") {
|
||||||
+ exclude(group = "org.apache.logging.log4j", module = "log4j-api")
|
+ exclude(group = "org.apache.logging.log4j", module = "log4j-api")
|
||||||
+ }
|
+ }
|
||||||
+ implementation("org.ow2.asm:asm-commons:9.7")
|
+ implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||||
+ implementation("commons-lang:commons-lang:2.6")
|
+ implementation("commons-lang:commons-lang:2.6")
|
||||||
+ runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
|
+ runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
|
||||||
+ runtimeOnly("com.mysql:mysql-connector-j:8.4.0")
|
+ runtimeOnly("com.mysql:mysql-connector-j:8.4.0")
|
||||||
@ -55,9 +55,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
|
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
|
||||||
+
|
+
|
||||||
+ testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
+ testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||||
|
+ testImplementation("org.junit.platform:junit-platform-suite-engine:1.10.0")
|
||||||
+ testImplementation("org.hamcrest:hamcrest:2.2")
|
+ testImplementation("org.hamcrest:hamcrest:2.2")
|
||||||
+ testImplementation("org.mockito:mockito-core:5.11.0")
|
+ testImplementation("org.mockito:mockito-core:5.14.1")
|
||||||
+ testImplementation("org.ow2.asm:asm-tree:9.7")
|
+ testImplementation("org.ow2.asm:asm-tree:9.7.1")
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+paperweight {
|
+paperweight {
|
||||||
@ -93,8 +94,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+tasks.test {
|
+tasks.test {
|
||||||
+ exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
|
+ include("**/**TestSuite.class")
|
||||||
+ useJUnitPlatform()
|
+ workingDir = temporaryDir
|
||||||
|
+ useJUnitPlatform {
|
||||||
|
+ forkEvery = 1
|
||||||
|
+ excludeTags("Slow")
|
||||||
|
+ }
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+fun TaskContainer.registerRunTask(
|
+fun TaskContainer.registerRunTask(
|
||||||
@ -183,6 +188,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
-
|
-
|
||||||
- <properties>
|
- <properties>
|
||||||
- <skipTests>true</skipTests>
|
- <skipTests>true</skipTests>
|
||||||
|
- <groups>AllFeatures,Bundle,Legacy,Normal,VanillaFeature</groups>
|
||||||
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
- <api.version>unknown</api.version>
|
- <api.version>unknown</api.version>
|
||||||
- <bt.name>git</bt.name>
|
- <bt.name>git</bt.name>
|
||||||
@ -226,7 +232,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- <dependency>
|
- <dependency>
|
||||||
- <groupId>org.ow2.asm</groupId>
|
- <groupId>org.ow2.asm</groupId>
|
||||||
- <artifactId>asm-commons</artifactId>
|
- <artifactId>asm-commons</artifactId>
|
||||||
- <version>9.7</version>
|
- <version>9.7.1</version>
|
||||||
- <scope>compile</scope>
|
- <scope>compile</scope>
|
||||||
- </dependency>
|
- </dependency>
|
||||||
- <!-- Mojang depends -->
|
- <!-- Mojang depends -->
|
||||||
@ -448,6 +454,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- <scope>test</scope>
|
- <scope>test</scope>
|
||||||
- </dependency>
|
- </dependency>
|
||||||
- <dependency>
|
- <dependency>
|
||||||
|
- <groupId>org.junit.platform</groupId>
|
||||||
|
- <artifactId>junit-platform-suite-engine</artifactId>
|
||||||
|
- <version>1.10.0</version>
|
||||||
|
- <scope>test</scope>
|
||||||
|
- </dependency>
|
||||||
|
- <dependency>
|
||||||
- <groupId>org.hamcrest</groupId>
|
- <groupId>org.hamcrest</groupId>
|
||||||
- <artifactId>hamcrest</artifactId>
|
- <artifactId>hamcrest</artifactId>
|
||||||
- <version>2.2</version>
|
- <version>2.2</version>
|
||||||
@ -456,13 +468,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- <dependency>
|
- <dependency>
|
||||||
- <groupId>org.mockito</groupId>
|
- <groupId>org.mockito</groupId>
|
||||||
- <artifactId>mockito-core</artifactId>
|
- <artifactId>mockito-core</artifactId>
|
||||||
- <version>5.11.0</version>
|
- <version>5.14.1</version>
|
||||||
- <scope>test</scope>
|
- <scope>test</scope>
|
||||||
- </dependency>
|
- </dependency>
|
||||||
- <dependency>
|
- <dependency>
|
||||||
- <groupId>org.ow2.asm</groupId>
|
- <groupId>org.ow2.asm</groupId>
|
||||||
- <artifactId>asm-tree</artifactId>
|
- <artifactId>asm-tree</artifactId>
|
||||||
- <version>9.7</version>
|
- <version>9.7.1</version>
|
||||||
- <scope>test</scope>
|
- <scope>test</scope>
|
||||||
- </dependency>
|
- </dependency>
|
||||||
- </dependencies>
|
- </dependencies>
|
||||||
@ -675,9 +687,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- <version>3.2.5</version>
|
- <version>3.2.5</version>
|
||||||
- <configuration>
|
- <configuration>
|
||||||
- <workingDirectory>${basedir}/target/test-server</workingDirectory>
|
- <workingDirectory>${basedir}/target/test-server</workingDirectory>
|
||||||
- <excludes>
|
- <reuseForks>false</reuseForks>
|
||||||
- <exclude>org/bukkit/craftbukkit/inventory/ItemStack*Test.java</exclude>
|
- <includes>
|
||||||
- </excludes>
|
- <include>**/*TestSuite.java</include>
|
||||||
|
- </includes>
|
||||||
- </configuration>
|
- </configuration>
|
||||||
- </plugin>
|
- </plugin>
|
||||||
- </plugins>
|
- </plugins>
|
||||||
|
@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -0,0 +0,0 @@ dependencies {
|
@@ -0,0 +0,0 @@ dependencies {
|
||||||
testImplementation("org.hamcrest:hamcrest:2.2")
|
testImplementation("org.hamcrest:hamcrest:2.2")
|
||||||
testImplementation("org.mockito:mockito-core:5.11.0")
|
testImplementation("org.mockito:mockito-core:5.14.1")
|
||||||
testImplementation("org.ow2.asm:asm-tree:9.7")
|
testImplementation("org.ow2.asm:asm-tree:9.7.1")
|
||||||
+ testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
|
+ testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
+
|
+
|
||||||
+class RegistryKeyTest extends AbstractTestingBase {
|
+@AllFeatures
|
||||||
|
+class RegistryKeyTest {
|
||||||
+
|
+
|
||||||
+ @BeforeAll
|
+ @BeforeAll
|
||||||
+ static void before() throws ClassNotFoundException {
|
+ static void before() throws ClassNotFoundException {
|
||||||
@ -64,7 +65,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ @ParameterizedTest
|
+ @ParameterizedTest
|
||||||
+ @MethodSource("data")
|
+ @MethodSource("data")
|
||||||
+ void testApiRegistryKeysExist(final RegistryKey<?> key) {
|
+ void testApiRegistryKeysExist(final RegistryKey<?> key) {
|
||||||
+ final Optional<Registry<Object>> registry = AbstractTestingBase.REGISTRY_CUSTOM.registry(ResourceKey.createRegistryKey(ResourceLocation.parse(key.key().asString())));
|
+ final Optional<Registry<Object>> registry = RegistryHelper.getRegistry().registry(ResourceKey.createRegistryKey(ResourceLocation.parse(key.key().asString())));
|
||||||
+ assertTrue(registry.isPresent(), "Missing vanilla registry for " + key.key().asString());
|
+ assertTrue(registry.isPresent(), "Missing vanilla registry for " + key.key().asString());
|
||||||
+
|
+
|
||||||
+ }
|
+ }
|
||||||
@ -338,11 +339,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+public @interface MethodParameterSource {
|
+public @interface MethodParameterSource {
|
||||||
+ String[] value() default {};
|
+ String[] value() default {};
|
||||||
+}
|
+}
|
||||||
|
diff --git a/src/test/java/org/bukkit/ExplosionResultTest.java b/src/test/java/org/bukkit/ExplosionResultTest.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/test/java/org/bukkit/ExplosionResultTest.java
|
||||||
|
+++ b/src/test/java/org/bukkit/ExplosionResultTest.java
|
||||||
|
@@ -0,0 +0,0 @@ import net.minecraft.world.level.Explosion;
|
||||||
|
import org.bukkit.craftbukkit.CraftExplosionResult;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
+@org.bukkit.support.environment.Normal // Paper - test changes - missing test suite annotation
|
||||||
|
public class ExplosionResultTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
diff --git a/src/test/java/org/bukkit/registry/RegistryClassTest.java b/src/test/java/org/bukkit/registry/RegistryClassTest.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/test/java/org/bukkit/registry/RegistryClassTest.java
|
||||||
|
+++ b/src/test/java/org/bukkit/registry/RegistryClassTest.java
|
||||||
|
@@ -0,0 +0,0 @@ import org.objectweb.asm.Type;
|
||||||
|
* Note: This test class assumes that feature flags only enable more features and do not disable vanilla ones.
|
||||||
|
*/
|
||||||
|
@AllFeatures
|
||||||
|
+@org.junit.jupiter.api.Disabled // Paper - disabled for now as it constructs a second root registry, which is not supported on paper
|
||||||
|
public class RegistryClassTest {
|
||||||
|
|
||||||
|
private static final Map<Class<? extends Keyed>, Data> INIT_DATA = new HashMap<>();
|
||||||
diff --git a/src/test/java/org/bukkit/registry/RegistryConstantsTest.java b/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
diff --git a/src/test/java/org/bukkit/registry/RegistryConstantsTest.java b/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
--- a/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
||||||
+++ b/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
+++ b/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
||||||
@@ -0,0 +0,0 @@ public class RegistryConstantsTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class RegistryConstantsTest {
|
||||||
@Test
|
@Test
|
||||||
public void testDamageType() {
|
public void testDamageType() {
|
||||||
this.testExcessConstants(DamageType.class, Registry.DAMAGE_TYPE);
|
this.testExcessConstants(DamageType.class, Registry.DAMAGE_TYPE);
|
||||||
@ -351,27 +376,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
diff --git a/src/test/java/org/bukkit/support/DummyServerHelper.java b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
--- a/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
+++ b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public final class DummyServerHelper {
|
||||||
MultiPackResourceManager resourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, resourceRepository.getAvailablePacks().stream().map(Pack::open).toList());
|
|
||||||
// add tags and loot tables for unit tests
|
|
||||||
LayeredRegistryAccess<RegistryLayer> layers = RegistryLayer.createRegistryAccess();
|
|
||||||
+ // Paper start - load registry here to ensure bukkit object registry are correctly delayed if needed
|
|
||||||
+ try {
|
|
||||||
+ Class.forName("org.bukkit.Registry");
|
|
||||||
+ } catch (ClassNotFoundException ignored) {}
|
|
||||||
+ // Paper end - load registry here to ensure bukkit object registry are correctly delayed if needed
|
|
||||||
layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES);
|
|
||||||
REGISTRY_CUSTOM = layers.compositeAccess().freeze();
|
|
||||||
// Register vanilla pack
|
|
||||||
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
|
||||||
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
|
||||||
@@ -0,0 +0,0 @@ public final class DummyServer {
|
|
||||||
when(instance.getTag(any(), any(), any())).then(mock -> {
|
when(instance.getTag(any(), any(), any())).then(mock -> {
|
||||||
String registry = mock.getArgument(0);
|
String registry = mock.getArgument(0);
|
||||||
Class<?> clazz = mock.getArgument(2);
|
Class<?> clazz = mock.getArgument(2);
|
||||||
@ -380,7 +389,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
switch (registry) {
|
switch (registry) {
|
||||||
case org.bukkit.Tag.REGISTRY_BLOCKS -> {
|
case org.bukkit.Tag.REGISTRY_BLOCKS -> {
|
||||||
@@ -0,0 +0,0 @@ public final class DummyServer {
|
@@ -0,0 +0,0 @@ public final class DummyServerHelper {
|
||||||
}
|
}
|
||||||
case org.bukkit.Tag.REGISTRY_FLUIDS -> {
|
case org.bukkit.Tag.REGISTRY_FLUIDS -> {
|
||||||
Preconditions.checkArgument(clazz == org.bukkit.Fluid.class, "Fluid namespace must have fluid type");
|
Preconditions.checkArgument(clazz == org.bukkit.Fluid.class, "Fluid namespace must have fluid type");
|
||||||
@ -408,11 +417,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper start - testing additions
|
+ // Paper start - testing additions
|
||||||
+ final Thread currentThread = Thread.currentThread();
|
+ final Thread currentThread = Thread.currentThread();
|
||||||
+ when(instance.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread));
|
+ when(instance.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread));
|
||||||
+
|
|
||||||
+ final org.bukkit.plugin.PluginManager pluginManager = new org.bukkit.plugin.SimplePluginManager(instance, new org.bukkit.command.SimpleCommandMap(instance));
|
+ final org.bukkit.plugin.PluginManager pluginManager = new org.bukkit.plugin.SimplePluginManager(instance, new org.bukkit.command.SimpleCommandMap(instance));
|
||||||
+ when(instance.getPluginManager()).thenReturn(pluginManager);
|
+ when(instance.getPluginManager()).thenReturn(pluginManager);
|
||||||
+ // paper end - testing additions
|
+ // Paper end - testing additions
|
||||||
+
|
+
|
||||||
Bukkit.setServer(instance);
|
return instance;
|
||||||
} catch (Throwable t) {
|
}
|
||||||
throw new Error(t);
|
}
|
||||||
|
diff --git a/src/test/java/org/bukkit/support/RegistryHelper.java b/src/test/java/org/bukkit/support/RegistryHelper.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/test/java/org/bukkit/support/RegistryHelper.java
|
||||||
|
+++ b/src/test/java/org/bukkit/support/RegistryHelper.java
|
||||||
|
@@ -0,0 +0,0 @@ public final class RegistryHelper {
|
||||||
|
private static LayeredRegistryAccess<RegistryLayer> createLayers(MultiPackResourceManager resourceManager) {
|
||||||
|
// add tags and loot tables for unit tests
|
||||||
|
LayeredRegistryAccess<RegistryLayer> layers = RegistryLayer.createRegistryAccess();
|
||||||
|
+ // Paper start - load registry here to ensure bukkit object registry are correctly delayed if needed
|
||||||
|
+ try {
|
||||||
|
+ Class.forName("org.bukkit.Registry");
|
||||||
|
+ } catch (final ClassNotFoundException ignored) {}
|
||||||
|
+ // Paper end - load registry here to ensure bukkit object registry are correctly delayed if needed
|
||||||
|
layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES);
|
||||||
|
|
||||||
|
return layers;
|
||||||
|
@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ alsoShade(log4jPlugins.output)
|
+ alsoShade(log4jPlugins.output)
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
|
implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
|
||||||
implementation("org.ow2.asm:asm-commons:9.7")
|
implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||||
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
|
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
|
||||||
@@ -0,0 +0,0 @@ tasks.check {
|
@@ -0,0 +0,0 @@ tasks.check {
|
||||||
dependsOn(scanJar)
|
dependsOn(scanJar)
|
||||||
@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+// Paper end - use TCA for console improvements
|
+// Paper end - use TCA for console improvements
|
||||||
|
|
||||||
tasks.test {
|
tasks.test {
|
||||||
exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
|
include("**/**TestSuite.class")
|
||||||
diff --git a/src/log4jPlugins/java/io/papermc/paper/console/StripANSIConverter.java b/src/log4jPlugins/java/io/papermc/paper/console/StripANSIConverter.java
|
diff --git a/src/log4jPlugins/java/io/papermc/paper/console/StripANSIConverter.java b/src/log4jPlugins/java/io/papermc/paper/console/StripANSIConverter.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
|
@ -35,13 +35,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import org.bukkit.Instrument;
|
+import org.bukkit.Instrument;
|
||||||
+import org.bukkit.craftbukkit.CraftSound;
|
+import org.bukkit.craftbukkit.CraftSound;
|
||||||
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.junit.jupiter.params.ParameterizedTest;
|
+import org.junit.jupiter.params.ParameterizedTest;
|
||||||
+import org.junit.jupiter.params.provider.MethodSource;
|
+import org.junit.jupiter.params.provider.MethodSource;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
+
|
+
|
||||||
+class InstrumentSoundTest extends AbstractTestingBase {
|
+@AllFeatures
|
||||||
|
+class InstrumentSoundTest {
|
||||||
+
|
+
|
||||||
+ static Stream<Instrument> bukkitInstruments() {
|
+ static Stream<Instrument> bukkitInstruments() {
|
||||||
+ return Arrays.stream(Instrument.values()).filter(i -> i.getSound() != null);
|
+ return Arrays.stream(Instrument.values()).filter(i -> i.getSound() != null);
|
||||||
|
@ -33,7 +33,7 @@ diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
||||||
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
||||||
@@ -0,0 +0,0 @@ public class ItemMetaTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class ItemMetaTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
|
||||||
@@ -0,0 +0,0 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
|
@@ -0,0 +0,0 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
|
||||||
this.blockEntityTag = te.blockEntityTag;
|
this.position = te.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
- CraftMetaBlockState(DataComponentPatch tag, Material material) {
|
- CraftMetaBlockState(DataComponentPatch tag, Material material) {
|
||||||
@ -304,7 +304,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ super(tag, extraHandledDcts); // Paper
|
+ super(tag, extraHandledDcts); // Paper
|
||||||
this.material = material;
|
this.material = material;
|
||||||
|
|
||||||
getOrEmpty(tag, CraftMetaBlockState.BLOCK_ENTITY_TAG).ifPresent((nbt) -> {
|
getOrEmpty(tag, CraftMetaBlockState.BLOCK_ENTITY_TAG).ifPresent((blockTag) -> {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
||||||
@ -792,7 +792,7 @@ diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCu
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java
|
--- a/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java
|
||||||
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java
|
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java
|
||||||
@@ -0,0 +0,0 @@ public class DeprecatedItemMetaCustomValueTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class DeprecatedItemMetaCustomValueTest {
|
||||||
CraftMetaItem.Applicator compound = new CraftMetaItem.Applicator();
|
CraftMetaItem.Applicator compound = new CraftMetaItem.Applicator();
|
||||||
itemMeta.applyToItem(compound);
|
itemMeta.applyToItem(compound);
|
||||||
|
|
||||||
@ -813,14 +813,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import io.github.classgraph.ClassInfo;
|
+import io.github.classgraph.ClassInfo;
|
||||||
+import io.github.classgraph.ClassInfoList;
|
+import io.github.classgraph.ClassInfoList;
|
||||||
+import io.github.classgraph.ScanResult;
|
+import io.github.classgraph.ScanResult;
|
||||||
+import org.bukkit.support.AbstractTestingBase;
|
+import org.bukkit.support.environment.AllFeatures;
|
||||||
+import org.junit.jupiter.api.Test;
|
+import org.junit.jupiter.api.Test;
|
||||||
+
|
+
|
||||||
+import static org.junit.jupiter.api.Assertions.assertFalse;
|
+import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
+
|
+
|
||||||
+// in cb package because of package-private stuff
|
+// in cb package because of package-private stuff
|
||||||
+class MetaHandledTagsTest extends AbstractTestingBase {
|
+@AllFeatures
|
||||||
|
+class MetaHandledTagsTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
+ public void checkAllMetasHaveHandledTags() {
|
+ public void checkAllMetasHaveHandledTags() {
|
||||||
@ -843,7 +844,7 @@ diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContai
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java
|
--- a/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java
|
||||||
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java
|
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java
|
||||||
@@ -0,0 +0,0 @@ public class PersistentDataContainerTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class PersistentDataContainerTest {
|
||||||
CraftMetaItem.Applicator compound = new CraftMetaItem.Applicator();
|
CraftMetaItem.Applicator compound = new CraftMetaItem.Applicator();
|
||||||
itemMeta.applyToItem(compound);
|
itemMeta.applyToItem(compound);
|
||||||
|
|
||||||
@ -852,7 +853,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -0,0 +0,0 @@ public class PersistentDataContainerTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class PersistentDataContainerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmptyListApplicationToAnyType() throws IOException {
|
public void testEmptyListApplicationToAnyType() throws IOException {
|
||||||
@ -861,7 +862,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
final PersistentDataContainer container = craftItem.getPersistentDataContainer();
|
final PersistentDataContainer container = craftItem.getPersistentDataContainer();
|
||||||
|
|
||||||
container.set(PersistentDataContainerTest.requestKey("list"), PersistentDataType.LIST.strings(), List.of());
|
container.set(PersistentDataContainerTest.requestKey("list"), PersistentDataType.LIST.strings(), List.of());
|
||||||
@@ -0,0 +0,0 @@ public class PersistentDataContainerTest extends AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public class PersistentDataContainerTest {
|
||||||
final CraftMetaItem.Applicator storage = new CraftMetaItem.Applicator();
|
final CraftMetaItem.Applicator storage = new CraftMetaItem.Applicator();
|
||||||
craftItem.applyToItem(storage);
|
craftItem.applyToItem(storage);
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 1fc1020ad0d91a1cf6bfaae6f0441c24be701fbf
|
Subproject commit bb4e97c60d2978a1d008f21295a5234228341e14
|
@ -1 +1 @@
|
|||||||
Subproject commit bbb30e7a853eb15c00dfea1bd46715101c777c8b
|
Subproject commit 0a7bd6c81a33cfaaa2f4d2456c6b237792f38fe6
|
Loading…
Reference in New Issue
Block a user