diff options
author | Lulu13022002 <[email protected]> | 2024-11-01 20:21:35 +0100 |
---|---|---|
committer | Owen1212055 <[email protected]> | 2024-11-18 14:50:38 -0500 |
commit | 9184543bdcfbda6b5f245de7d04057c5c732eaab (patch) | |
tree | 4b526fe8fddd404d10330afc9dae2c967615b3c7 | |
parent | 032bb38193f2e58ddb8cf4ad69b53a30e1385d87 (diff) | |
download | Paper-9184543bdcfbda6b5f245de7d04057c5c732eaab.tar.gz Paper-9184543bdcfbda6b5f245de7d04057c5c732eaab.zip |
add some preconditions
and fix PotionContents customName
-rw-r--r-- | patches/api/0497-WIP-DataComponent-API.patch | 108 | ||||
-rw-r--r-- | patches/server/1058-WIP-DataComponent-API.patch | 126 |
2 files changed, 89 insertions, 145 deletions
diff --git a/patches/api/0497-WIP-DataComponent-API.patch b/patches/api/0497-WIP-DataComponent-API.patch index 1b21595def..ed8eacb9ee 100644 --- a/patches/api/0497-WIP-DataComponent-API.patch +++ b/patches/api/0497-WIP-DataComponent-API.patch @@ -153,10 +153,10 @@ index 0000000000000000000000000000000000000000..e2266d86a4dd1bf20346e48c428f8baf +} diff --git a/src/main/java/io/papermc/paper/datacomponent/DataComponentTypes.java b/src/main/java/io/papermc/paper/datacomponent/DataComponentTypes.java new file mode 100644 -index 0000000000000000000000000000000000000000..c85f7f63aa9a70d50afc196d38d9fdb186b697c1 +index 0000000000000000000000000000000000000000..e79800d626fdde02be88c75fa13d4793e7af1168 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/DataComponentTypes.java -@@ -0,0 +1,346 @@ +@@ -0,0 +1,345 @@ +package io.papermc.paper.datacomponent; + +import io.papermc.paper.datacomponent.item.BannerPatternLayers; @@ -211,7 +211,6 @@ index 0000000000000000000000000000000000000000..c85f7f63aa9a70d50afc196d38d9fdb1 +import org.checkerframework.checker.index.qual.Positive; +import org.checkerframework.common.value.qual.IntRange; +import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.NullMarked; + +import static java.util.Objects.requireNonNull; @@ -328,7 +327,7 @@ index 0000000000000000000000000000000000000000..c85f7f63aa9a70d50afc196d38d9fdb1 + * Overrides the enchantment glint effect on an item. + * If not present, default behaviour is used. + */ -+ public static final DataComponentType.Valued<@NonNull Boolean> ENCHANTMENT_GLINT_OVERRIDE = valued("enchantment_glint_override"); ++ public static final DataComponentType.Valued<Boolean> ENCHANTMENT_GLINT_OVERRIDE = valued("enchantment_glint_override"); + /** + * Marks that a projectile item would be intangible when fired + * (i.e. can only be picked up by a creative mode player). @@ -388,7 +387,7 @@ index 0000000000000000000000000000000000000000..c85f7f63aa9a70d50afc196d38d9fdb1 + /** + * Internal map item state used in the map crafting recipe. + */ -+ public static final DataComponentType.Valued<@NonNull MapPostProcessing> MAP_POST_PROCESSING = valued("map_post_processing"); ++ public static final DataComponentType.Valued<MapPostProcessing> MAP_POST_PROCESSING = valued("map_post_processing"); + /** + * Holds all projectiles that have been loaded into a Crossbow. + * If not present, the Crossbow is not charged. @@ -793,10 +792,10 @@ index 0000000000000000000000000000000000000000..09240fe94f7f48d4d24e99cc362aed55 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Consumable.java b/src/main/java/io/papermc/paper/datacomponent/item/Consumable.java new file mode 100644 -index 0000000000000000000000000000000000000000..98b7d0a121246cd396ec708d26a7aac2f41e7122 +index 0000000000000000000000000000000000000000..55ba9e1d09a35d9c9a034f928d6b9383517eb775 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/Consumable.java -@@ -0,0 +1,72 @@ +@@ -0,0 +1,70 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.datacomponent.BuildableDataComponent; @@ -866,8 +865,6 @@ index 0000000000000000000000000000000000000000..98b7d0a121246cd396ec708d26a7aac2 + @Contract(value = "_ -> this", mutates = "this") + Builder addEffects(Collection<ConsumeEffect> effects); + } -+ -+ +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/CustomModelData.java b/src/main/java/io/papermc/paper/datacomponent/item/CustomModelData.java new file mode 100644 @@ -905,10 +902,10 @@ index 0000000000000000000000000000000000000000..d416c9d25b3ab88bf1e208c6faf92a8e +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/DamageResistant.java b/src/main/java/io/papermc/paper/datacomponent/item/DamageResistant.java new file mode 100644 -index 0000000000000000000000000000000000000000..824797cf1022e10232bcb27b02a90c698aa15638 +index 0000000000000000000000000000000000000000..6cbd73cb2a11f4858b44a2f57d2fe0acb1eb9fb5 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/DamageResistant.java -@@ -0,0 +1,31 @@ +@@ -0,0 +1,30 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.registry.tag.TagKey; @@ -938,7 +935,6 @@ index 0000000000000000000000000000000000000000..824797cf1022e10232bcb27b02a90c69 + */ + @Contract(value = "-> new", pure = true) + TagKey<DamageType> types(); -+ +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/DeathProtection.java b/src/main/java/io/papermc/paper/datacomponent/item/DeathProtection.java new file mode 100644 @@ -1060,12 +1056,13 @@ index 0000000000000000000000000000000000000000..d80581fc8b894cc4d4af9741244b1bb0 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Enchantable.java b/src/main/java/io/papermc/paper/datacomponent/item/Enchantable.java new file mode 100644 -index 0000000000000000000000000000000000000000..eb0f1c986f20d88175de789a45a4b63c920d46d8 +index 0000000000000000000000000000000000000000..91a17840755d652fa94cf357f1951efad644798c --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/Enchantable.java -@@ -0,0 +1,29 @@ +@@ -0,0 +1,30 @@ +package io.papermc.paper.datacomponent.item; + ++import org.checkerframework.checker.index.qual.Positive; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Contract; +import org.jspecify.annotations.NullMarked; @@ -1080,7 +1077,7 @@ index 0000000000000000000000000000000000000000..eb0f1c986f20d88175de789a45a4b63c +public interface Enchantable { + + @Contract(value = "_ -> new", pure = true) -+ static Enchantable enchantable(final int level) { ++ static Enchantable enchantable(final @Positive int level) { + return ItemComponentTypesBridge.bridge().enchantable(level); + } + @@ -1091,7 +1088,7 @@ index 0000000000000000000000000000000000000000..eb0f1c986f20d88175de789a45a4b63c + * @return the value + */ + @Contract(pure = true) -+ int value(); ++ @Positive int value(); +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Equippable.java b/src/main/java/io/papermc/paper/datacomponent/item/Equippable.java new file mode 100644 @@ -1862,7 +1859,7 @@ index 0000000000000000000000000000000000000000..72ab4707f85a06a05a238f52b0d165e3 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemEnchantments.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemEnchantments.java new file mode 100644 -index 0000000000000000000000000000000000000000..eb840e0894eac471cd9d63f9e135db88bba47253 +index 0000000000000000000000000000000000000000..fca271ea198209bd48cd02f4476e89e5e3e9f396 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemEnchantments.java @@ -0,0 +1,68 @@ @@ -1903,7 +1900,7 @@ index 0000000000000000000000000000000000000000..eb840e0894eac471cd9d63f9e135db88 + * @return enchantments + */ + @Contract(pure = true) -+ @Unmodifiable Map<Enchantment, @IntRange(from = 0, to = 255) Integer> enchantments(); ++ @Unmodifiable Map<Enchantment, @IntRange(from = 1, to = 255) Integer> enchantments(); + + /** + * Builder for {@link ItemEnchantments}. @@ -2391,19 +2388,20 @@ index 0000000000000000000000000000000000000000..87845d19a25ed2ae79b868fcfe40b88a +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/OminousBottleAmplifier.java b/src/main/java/io/papermc/paper/datacomponent/item/OminousBottleAmplifier.java new file mode 100644 -index 0000000000000000000000000000000000000000..55e4985f97a0e557108134d1e211786fd31befc8 +index 0000000000000000000000000000000000000000..cd2a4287294b628fe314b80fa48ccc694ac3f3b8 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/OminousBottleAmplifier.java -@@ -0,0 +1,28 @@ +@@ -0,0 +1,29 @@ +package io.papermc.paper.datacomponent.item; + +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.Range; +import org.jspecify.annotations.NullMarked; + +/** + * Holds the ominous bottle amplifier. -+ * @see io.papermc.paper.datacomponent.DataComponentTypes#CUSTOM_MODEL_DATA ++ * @see io.papermc.paper.datacomponent.DataComponentTypes#OMINOUS_BOTTLE_AMPLIFIER + */ +@NullMarked @@ -2411,7 +2409,7 @@ index 0000000000000000000000000000000000000000..55e4985f97a0e557108134d1e211786f +public interface OminousBottleAmplifier { + + @Contract(value = "_ -> new", pure = true) -+ static OminousBottleAmplifier amplifier(final int amplifier) { ++ static OminousBottleAmplifier amplifier(final @Range(from = 0, to = 4) int amplifier) { + return ItemComponentTypesBridge.bridge().ominousBottleAmplifier(amplifier); + } + @@ -2421,11 +2419,11 @@ index 0000000000000000000000000000000000000000..55e4985f97a0e557108134d1e211786f + * @return the amplifier + */ + @Contract(pure = true) -+ int amplifier(); ++ @Range(from = 0, to = 4) int amplifier(); +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PotDecorations.java b/src/main/java/io/papermc/paper/datacomponent/item/PotDecorations.java new file mode 100644 -index 0000000000000000000000000000000000000000..921cba1b8e3810b0cdc2486775d6cb87e10f0c0b +index 0000000000000000000000000000000000000000..6da78b8735a6cadd1282fa2fafd8b0f74f087fb4 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/PotDecorations.java @@ -0,0 +1,109 @@ @@ -2530,20 +2528,20 @@ index 0000000000000000000000000000000000000000..921cba1b8e3810b0cdc2486775d6cb87 + /** + * Set the {@link ItemType} for the front. + * -+ * @param font item for the front ++ * @param front item for the front + * @return the builder for chaining + * @see #front() + */ + @Contract(value = "_ -> this", mutates = "this") -+ Builder front(@Nullable ItemType font); ++ Builder front(@Nullable ItemType front); + } +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PotionContents.java b/src/main/java/io/papermc/paper/datacomponent/item/PotionContents.java new file mode 100644 -index 0000000000000000000000000000000000000000..3e9ccec067b6c390ace1df9707be89c4b7117565 +index 0000000000000000000000000000000000000000..7bfb093d6802828499fb06be1d900f41bd52daba --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/PotionContents.java -@@ -0,0 +1,119 @@ +@@ -0,0 +1,120 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.datacomponent.DataComponentBuilder; @@ -2603,7 +2601,8 @@ index 0000000000000000000000000000000000000000..3e9ccec067b6c390ace1df9707be89c4 + * @return name override, or {@code null} if not present + * @apiNote This is used in the display of tipped arrow and potion items. + */ -+ @Contract(pure = true) @Nullable String customName(); ++ @Contract(pure = true) ++ @Nullable String customName(); + + @ApiStatus.Experimental + @ApiStatus.NonExtendable @@ -2665,10 +2664,10 @@ index 0000000000000000000000000000000000000000..3e9ccec067b6c390ace1df9707be89c4 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Repairable.java b/src/main/java/io/papermc/paper/datacomponent/item/Repairable.java new file mode 100644 -index 0000000000000000000000000000000000000000..77c711d6d3f5b9f6a5fbda85a22645b8a2976f80 +index 0000000000000000000000000000000000000000..ff84d9123aab0ad2f93b397e20a37f21894547a3 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/Repairable.java -@@ -0,0 +1,31 @@ +@@ -0,0 +1,30 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.registry.set.RegistryKeySet; @@ -2698,7 +2697,6 @@ index 0000000000000000000000000000000000000000..77c711d6d3f5b9f6a5fbda85a22645b8 + */ + @Contract(value = "-> new", pure = true) + RegistryKeySet<ItemType> types(); -+ +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ResolvableProfile.java b/src/main/java/io/papermc/paper/datacomponent/item/ResolvableProfile.java new file mode 100644 @@ -3599,10 +3597,10 @@ index 0000000000000000000000000000000000000000..86915d2c1435d4a5df2bce0318bdf169 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ApplyStatusEffectsConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ApplyStatusEffectsConsumeEffect.java new file mode 100644 -index 0000000000000000000000000000000000000000..d2d07738c4438901e6169f54784440729d65f174 +index 0000000000000000000000000000000000000000..0dac27dc6002b599deed7fb779de86f96907a942 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ApplyStatusEffectsConsumeEffect.java -@@ -0,0 +1,43 @@ +@@ -0,0 +1,42 @@ +package io.papermc.paper.datacomponent.item.consumable; + +import java.util.List; @@ -3644,7 +3642,6 @@ index 0000000000000000000000000000000000000000..d2d07738c4438901e6169f5478444072 + * @return chance + */ + float probability(); -+ +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ClearAllStatusEffectsConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ClearAllStatusEffectsConsumeEffect.java new file mode 100644 @@ -3675,10 +3672,10 @@ index 0000000000000000000000000000000000000000..d6399bc32c5c330dc9969bdfc8f98f43 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridge.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridge.java new file mode 100644 -index 0000000000000000000000000000000000000000..310a3d7903f426d8a2d685471caac1222adb3869 +index 0000000000000000000000000000000000000000..85cb8c4ebc7b372842f8a262790f3c5dcb86f161 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridge.java -@@ -0,0 +1,33 @@ +@@ -0,0 +1,32 @@ +package io.papermc.paper.datacomponent.item.consumable; + +import io.papermc.paper.registry.set.RegistryKeySet; @@ -3710,7 +3707,6 @@ index 0000000000000000000000000000000000000000..310a3d7903f426d8a2d685471caac122 + PlaySoundConsumeEffect playSoundEffect(Key sound); + + TeleportRandomlyConsumeEffect teleportRandomlyEffect(float diameter); -+ +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumeEffect.java new file mode 100644 @@ -3757,10 +3753,10 @@ index 0000000000000000000000000000000000000000..8cd6dbe4ea5ee3270b9428a9c29cbd88 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PlaySoundConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PlaySoundConsumeEffect.java new file mode 100644 -index 0000000000000000000000000000000000000000..ed12a1db6c45e31954923fe1ca09df70a1b10181 +index 0000000000000000000000000000000000000000..aca3a7d5f78385b34ffe39c2e293b23d2fc138b5 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PlaySoundConsumeEffect.java -@@ -0,0 +1,35 @@ +@@ -0,0 +1,33 @@ +package io.papermc.paper.datacomponent.item.consumable; + +import net.kyori.adventure.key.Key; @@ -3793,18 +3789,15 @@ index 0000000000000000000000000000000000000000..ed12a1db6c45e31954923fe1ca09df70 + * @return sound effect + */ + Key sound(); -+ -+ +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/RemoveStatusEffectsConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/RemoveStatusEffectsConsumeEffect.java new file mode 100644 -index 0000000000000000000000000000000000000000..04fcd7a7087817c3ec77a701d3ddc6e5a4b06715 +index 0000000000000000000000000000000000000000..70b406a124dfb16a7354dab457f5bd5dc8f36832 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/RemoveStatusEffectsConsumeEffect.java -@@ -0,0 +1,36 @@ +@@ -0,0 +1,34 @@ +package io.papermc.paper.datacomponent.item.consumable; + -+ +import io.papermc.paper.registry.set.RegistryKeySet; +import org.bukkit.potion.PotionEffectType; +import org.jetbrains.annotations.ApiStatus; @@ -3836,14 +3829,13 @@ index 0000000000000000000000000000000000000000..04fcd7a7087817c3ec77a701d3ddc6e5 + * @return effects + */ + RegistryKeySet<PotionEffectType> removeEffects(); -+ +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/TeleportRandomlyConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/TeleportRandomlyConsumeEffect.java new file mode 100644 -index 0000000000000000000000000000000000000000..6471e9674b2563637fededa38d2130407c30c83d +index 0000000000000000000000000000000000000000..f0751babbaaaedb188c109589aff1a65cde3bec1 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/TeleportRandomlyConsumeEffect.java -@@ -0,0 +1,30 @@ +@@ -0,0 +1,29 @@ +package io.papermc.paper.datacomponent.item.consumable; + +import org.jetbrains.annotations.ApiStatus; @@ -3872,19 +3864,7 @@ index 0000000000000000000000000000000000000000..6471e9674b2563637fededa38d213040 + * @return teleportation diameter + */ + float diameter(); -+ +} -diff --git a/src/main/java/io/papermc/paper/datacomponent/package-info.java b/src/main/java/io/papermc/paper/datacomponent/package-info.java -new file mode 100644 -index 0000000000000000000000000000000000000000..3ddd1f787e97c22eee3e32bb2a9660a8e300d7f9 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/package-info.java -@@ -0,0 +1,5 @@ -+@DefaultQualifier(NonNull.class) -+package io.papermc.paper.datacomponent; -+ -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.framework.qual.DefaultQualifier; diff --git a/src/main/java/io/papermc/paper/item/MapPostProcessing.java b/src/main/java/io/papermc/paper/item/MapPostProcessing.java new file mode 100644 index 0000000000000000000000000000000000000000..5843768d0be2ae4a0219636ed7640727808da567 @@ -3898,7 +3878,7 @@ index 0000000000000000000000000000000000000000..5843768d0be2ae4a0219636ed7640727 + SCALE +} diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java -index d8716f855806471728c35b3ec34efb808a5146cf..cf8a28a6e41fadeeffe358e5bcdc25bf6c351aea 100644 +index d8716f855806471728c35b3ec34efb808a5146cf..904ab9bf9d39e254c37d0e003b0b807cedcc57c3 100644 --- a/src/main/java/io/papermc/paper/registry/RegistryKey.java +++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java @@ -1,5 +1,6 @@ @@ -3908,10 +3888,14 @@ index d8716f855806471728c35b3ec34efb808a5146cf..cf8a28a6e41fadeeffe358e5bcdc25bf import net.kyori.adventure.key.Keyed; import org.bukkit.Art; import org.bukkit.Fluid; -@@ -114,6 +115,7 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl { +@@ -114,6 +115,11 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl { * @see io.papermc.paper.registry.keys.MenuTypeKeys */ RegistryKey<MenuType> MENU = create("menu"); ++ /** ++ * Built-in registry for data component types. ++ * <!-- @see io.papermc.paper.registry.keys.DataComponentTypeKeys todo generate --> ++ */ + RegistryKey<DataComponentType> DATA_COMPONENT_TYPE = create("data_component_type"); diff --git a/patches/server/1058-WIP-DataComponent-API.patch b/patches/server/1058-WIP-DataComponent-API.patch index b8f5e8c10a..0cf5780237 100644 --- a/patches/server/1058-WIP-DataComponent-API.patch +++ b/patches/server/1058-WIP-DataComponent-API.patch @@ -66,10 +66,10 @@ index 0000000000000000000000000000000000000000..08c717590a34584c359408c49c69379c +} diff --git a/src/main/java/io/papermc/paper/datacomponent/ComponentAdapters.java b/src/main/java/io/papermc/paper/datacomponent/ComponentAdapters.java new file mode 100644 -index 0000000000000000000000000000000000000000..1c861bd7773cbfce8c74403b9308c327580232cc +index 0000000000000000000000000000000000000000..e821b336b4c9e1c2fafd1ef21b559ebc9e46b13b --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/ComponentAdapters.java -@@ -0,0 +1,195 @@ +@@ -0,0 +1,189 @@ +package io.papermc.paper.datacomponent; + +import com.mojang.brigadier.exceptions.CommandSyntaxException; @@ -122,16 +122,10 @@ index 0000000000000000000000000000000000000000..1c861bd7773cbfce8c74403b9308c327 +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceKey; -+import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Unit; -+import net.minecraft.world.LockCode; +import net.minecraft.world.item.Rarity; +import net.minecraft.world.item.component.CustomData; -+import net.minecraft.world.item.component.CustomModelData; -+import net.minecraft.world.item.component.MapItemColor; +import net.minecraft.world.item.component.MapPostProcessing; -+import net.minecraft.world.level.saveddata.maps.MapId; -+import org.bukkit.Color; +import org.bukkit.DyeColor; +import org.bukkit.craftbukkit.CraftMusicInstrument; +import org.bukkit.craftbukkit.inventory.CraftMetaFirework; @@ -433,13 +427,14 @@ index 0000000000000000000000000000000000000000..74e883d50477b3b4dabdcb674d95e92e +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridgesImpl.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridgesImpl.java new file mode 100644 -index 0000000000000000000000000000000000000000..8ca01cd0c75d84e3e20aa3a325669b90da11aa6e +index 0000000000000000000000000000000000000000..518e0f5fa985b8f10a8c1e90bd1475f827acbf46 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridgesImpl.java -@@ -0,0 +1,234 @@ +@@ -0,0 +1,240 @@ +package io.papermc.paper.datacomponent.item; + +import com.destroystokyo.paper.profile.PlayerProfile; ++import com.google.common.base.Preconditions; +import io.papermc.paper.registry.PaperRegistries; +import io.papermc.paper.registry.set.PaperRegistrySets; +import io.papermc.paper.registry.set.RegistryKeySet; @@ -617,6 +612,7 @@ index 0000000000000000000000000000000000000000..8ca01cd0c75d84e3e20aa3a325669b90 + + @Override + public UseRemainder useRemainder(final ItemStack itemStack) { ++ Preconditions.checkArgument(!itemStack.isEmpty(), "Remaining item cannot be empty!"); + return new PaperUseRemainder( + new net.minecraft.world.item.component.UseRemainder(CraftItemStack.asNMSCopy(itemStack)) + ); @@ -629,6 +625,7 @@ index 0000000000000000000000000000000000000000..8ca01cd0c75d84e3e20aa3a325669b90 + + @Override + public UseCooldown.Builder useCooldown(final float seconds) { ++ Preconditions.checkArgument(seconds > 0, "seconds must be positive, was %s", seconds); + return new PaperUseCooldown.BuilderImpl(seconds); + } + @@ -666,6 +663,9 @@ index 0000000000000000000000000000000000000000..8ca01cd0c75d84e3e20aa3a325669b90 + + @Override + public PaperOminousBottleAmplifier ominousBottleAmplifier(final int amplifier) { ++ Preconditions.checkArgument(OminousBottleAmplifier.MIN_AMPLIFIER <= amplifier && amplifier <= OminousBottleAmplifier.MAX_AMPLIFIER, ++ "amplifier must be between %s-%s, was %s", OminousBottleAmplifier.MIN_AMPLIFIER, OminousBottleAmplifier.MAX_AMPLIFIER, amplifier ++ ); + return new PaperOminousBottleAmplifier( + new OminousBottleAmplifier(amplifier) + ); @@ -925,32 +925,26 @@ index 0000000000000000000000000000000000000000..db00e0d68dba2b844377248c8e70b5e2 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperConsumable.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperConsumable.java new file mode 100644 -index 0000000000000000000000000000000000000000..ddcd650d2f4d71ba8f602d2562ecb9b716a61fc9 +index 0000000000000000000000000000000000000000..216d8e5f55bf389985435a4ab3853f39b2e9d42e --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperConsumable.java -@@ -0,0 +1,153 @@ +@@ -0,0 +1,148 @@ +package io.papermc.paper.datacomponent.item; + ++import com.google.common.base.Preconditions; +import io.papermc.paper.adventure.PaperAdventure; -+import io.papermc.paper.block.BlockPredicate; +import io.papermc.paper.datacomponent.item.consumable.ConsumeEffect; +import io.papermc.paper.datacomponent.item.consumable.ItemUseAnimation; +import io.papermc.paper.datacomponent.item.consumable.PaperConsumableEffects; -+import io.papermc.paper.registry.RegistryKey; -+import io.papermc.paper.registry.set.PaperRegistrySets; +import java.util.ArrayList; +import java.util.Collection; -+import java.util.Collections; +import java.util.List; -+import java.util.Optional; +import net.kyori.adventure.key.Key; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; -+import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; -+import net.minecraft.world.item.component.Consumables; +import org.bukkit.craftbukkit.util.Handleable; +import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.nullness.qual.NonNull; @@ -1026,6 +1020,7 @@ index 0000000000000000000000000000000000000000..ddcd650d2f4d71ba8f602d2562ecb9b7 + + @Override + public @NonNull Builder consumeSeconds(@NonNegative final float consumeSeconds) { ++ Preconditions.checkArgument(consumeSeconds >= 0, "consumeSeconds must be non-negative, was %s", consumeSeconds); + this.consumeSeconds = consumeSeconds; + return this; + } @@ -2736,7 +2731,7 @@ index 0000000000000000000000000000000000000000..cb19491e0f43e075d76415cad2b8a441 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperPotionContents.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperPotionContents.java new file mode 100644 -index 0000000000000000000000000000000000000000..53a57ff74c501a313f1f973eb7c60e8fc09d309c +index 0000000000000000000000000000000000000000..329ee9ffd2e5d02556ce712102318a277e028557 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperPotionContents.java @@ -0,0 +1,109 @@ @@ -2817,8 +2812,8 @@ index 0000000000000000000000000000000000000000..53a57ff74c501a313f1f973eb7c60e8f + } + + @Override -+ public @NonNull Builder customName(@Nullable final String name) { -+ this.customName = customName; ++ public Builder customName(final @Nullable String name) { ++ this.customName = name; + return this; + } + @@ -2836,7 +2831,7 @@ index 0000000000000000000000000000000000000000..53a57ff74c501a313f1f973eb7c60e8f + + @Override + public PotionContents build() { -+ if (this.type == null && this.color == null && this.customEffects.isEmpty()) { ++ if (this.type == null && this.color == null && this.customEffects.isEmpty() && this.customName == null) { + return new PaperPotionContents(net.minecraft.world.item.alchemy.PotionContents.EMPTY); + } + @@ -2851,19 +2846,16 @@ index 0000000000000000000000000000000000000000..53a57ff74c501a313f1f973eb7c60e8f +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperRepairable.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperRepairable.java new file mode 100644 -index 0000000000000000000000000000000000000000..90f524f5c203d04cfa2593c439c7d9a8e987d355 +index 0000000000000000000000000000000000000000..a55c759cef85eb1a619289a9c7e8ecdc63f74c23 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperRepairable.java -@@ -0,0 +1,28 @@ +@@ -0,0 +1,25 @@ +package io.papermc.paper.datacomponent.item; + -+import io.papermc.paper.registry.PaperRegistries; +import io.papermc.paper.registry.RegistryKey; +import io.papermc.paper.registry.set.PaperRegistrySets; +import io.papermc.paper.registry.set.RegistryKeySet; -+import io.papermc.paper.registry.tag.TagKey; +import org.bukkit.craftbukkit.util.Handleable; -+import org.bukkit.damage.DamageType; +import org.bukkit.inventory.ItemType; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; @@ -2879,7 +2871,7 @@ index 0000000000000000000000000000000000000000..90f524f5c203d04cfa2593c439c7d9a8 + } + + @Override -+ public @NonNull RegistryKeySet<ItemType> types() { ++ public RegistryKeySet<ItemType> types() { + return PaperRegistrySets.convertToApi(RegistryKey.ITEM, this.impl.items()); + } +} @@ -3185,13 +3177,12 @@ index 0000000000000000000000000000000000000000..2ff5004427766b0034595ddad04aac6b +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperUseCooldown.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperUseCooldown.java new file mode 100644 -index 0000000000000000000000000000000000000000..587755c3ab532662b1cb9a6f662832e77dd7d0e2 +index 0000000000000000000000000000000000000000..c43b9a98483b81efc4acee4910eb8df367dabf0d --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperUseCooldown.java -@@ -0,0 +1,60 @@ +@@ -0,0 +1,59 @@ +package io.papermc.paper.datacomponent.item; + -+import com.google.common.base.Preconditions; +import io.papermc.paper.adventure.PaperAdventure; +import net.kyori.adventure.key.Key; +import net.minecraft.resources.ResourceLocation; @@ -3594,26 +3585,22 @@ index 0000000000000000000000000000000000000000..2e3a94c539e57832bcfad237401d8986 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridgeImpl.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridgeImpl.java new file mode 100644 -index 0000000000000000000000000000000000000000..207bcdf0079163037c03e4cb5f419237d9b70e21 +index 0000000000000000000000000000000000000000..ff0c55662b79ee412e64e2532ab5c9495fdf42f4 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridgeImpl.java -@@ -0,0 +1,68 @@ +@@ -0,0 +1,64 @@ +package io.papermc.paper.datacomponent.item.consumable; + ++import com.google.common.base.Preconditions; +import java.util.ArrayList; +import java.util.List; -+import java.util.Optional; -+import java.util.ServiceLoader; +import com.google.common.collect.Lists; -+import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.datacomponent.ComponentUtils; +import io.papermc.paper.registry.set.PaperRegistrySets; +import io.papermc.paper.registry.set.RegistryKeySet; +import net.kyori.adventure.key.Key; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; -+import net.minecraft.resources.ResourceLocation; -+import net.minecraft.sounds.SoundEvent; +import org.bukkit.craftbukkit.potion.CraftPotionUtil; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; @@ -3624,6 +3611,7 @@ index 0000000000000000000000000000000000000000..207bcdf0079163037c03e4cb5f419237 + + @Override + public ApplyStatusEffectsConsumeEffect applyStatusEffects(final List<PotionEffect> effectList, final float probability) { ++ Preconditions.checkArgument(0 <= probability && probability <= 1, "probability must be between 0-1, was %s", probability); + return new PaperApplyStatusEffectsConsumeEffect( + new net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect( + new ArrayList<>(Lists.transform(effectList, CraftPotionUtil::fromBukkit)), @@ -3659,25 +3647,23 @@ index 0000000000000000000000000000000000000000..207bcdf0079163037c03e4cb5f419237 + + @Override + public TeleportRandomlyConsumeEffect teleportRandomlyEffect(final float diameter) { ++ Preconditions.checkArgument(diameter > 0, "diameter must be positive, was %s", diameter); + return new PaperTeleportRandomlyConsumeEffect( + new net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect(diameter) + ); + } -+ -+ +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperApplyStatusEffectsConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperApplyStatusEffectsConsumeEffect.java new file mode 100644 -index 0000000000000000000000000000000000000000..61888e17d7e66012cdb196cb26162e39b0f25588 +index 0000000000000000000000000000000000000000..8fc1648885fb3ca89e318377cb85039afb4def5e --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperApplyStatusEffectsConsumeEffect.java -@@ -0,0 +1,30 @@ +@@ -0,0 +1,29 @@ +package io.papermc.paper.datacomponent.item.consumable; + +import java.util.List; +import net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect; +import org.bukkit.craftbukkit.potion.CraftPotionUtil; -+import org.bukkit.craftbukkit.util.Handleable; +import org.bukkit.potion.PotionEffect; +import org.checkerframework.checker.nullness.qual.NonNull; + @@ -3704,16 +3690,12 @@ index 0000000000000000000000000000000000000000..61888e17d7e66012cdb196cb26162e39 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperClearAllStatusEffectsConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperClearAllStatusEffectsConsumeEffect.java new file mode 100644 -index 0000000000000000000000000000000000000000..adcaa40e0b3d61ba2b7a563704fce0a5b180038e +index 0000000000000000000000000000000000000000..8641f6f49171dd29dbf3e14f6198f8bfb3e38b03 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperClearAllStatusEffectsConsumeEffect.java -@@ -0,0 +1,15 @@ +@@ -0,0 +1,11 @@ +package io.papermc.paper.datacomponent.item.consumable; + -+import org.bukkit.craftbukkit.util.Handleable; -+ -+import static io.papermc.paper.datacomponent.ComponentUtils.transform; -+ +public record PaperClearAllStatusEffectsConsumeEffect( + net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect impl +) implements io.papermc.paper.datacomponent.item.consumable.ClearAllStatusEffectsConsumeEffect, PaperConsumableEffectImpl<net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect> { @@ -3738,23 +3720,20 @@ index 0000000000000000000000000000000000000000..05ede1d3f5b0b5ea3a5004cb4a7a153e +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperConsumableEffects.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperConsumableEffects.java new file mode 100644 -index 0000000000000000000000000000000000000000..006fc44b489e25658355da7d9303174c2a8fff19 +index 0000000000000000000000000000000000000000..3be0636e9e0b0f0c3b2834e8e8a29864a873b166 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperConsumableEffects.java -@@ -0,0 +1,32 @@ +@@ -0,0 +1,29 @@ +package io.papermc.paper.datacomponent.item.consumable; + -+import io.papermc.paper.datacomponent.item.Consumable; +import net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect; +import net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect; +import net.minecraft.world.item.consume_effects.PlaySoundConsumeEffect; +import net.minecraft.world.item.consume_effects.RemoveStatusEffectsConsumeEffect; +import net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect; -+import org.bukkit.craftbukkit.util.Handleable; + +public class PaperConsumableEffects { + -+ + public static ConsumeEffect fromNms(net.minecraft.world.item.consume_effects.ConsumeEffect consumable) { + return switch (consumable) { + case ApplyStatusEffectsConsumeEffect effect -> new PaperApplyStatusEffectsConsumeEffect(effect); @@ -3762,7 +3741,7 @@ index 0000000000000000000000000000000000000000..006fc44b489e25658355da7d9303174c + case PlaySoundConsumeEffect effect -> new PaperPlaySoundConsumeEffect(effect); + case RemoveStatusEffectsConsumeEffect effect -> new PaperRemoveStatusEffectsConsumeEffect(effect); + case TeleportRandomlyConsumeEffect effect -> new PaperTeleportRandomlyConsumeEffect(effect); -+ default -> throw new UnsupportedOperationException("Dont know how to convert " + consumable.getClass()); ++ default -> throw new UnsupportedOperationException("Don't know how to convert " + consumable.getClass()); + }; + } + @@ -3776,20 +3755,17 @@ index 0000000000000000000000000000000000000000..006fc44b489e25658355da7d9303174c +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperPlaySoundConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperPlaySoundConsumeEffect.java new file mode 100644 -index 0000000000000000000000000000000000000000..6667a5dfd3de7f27dc6c35f95f3c3211f77a78fe +index 0000000000000000000000000000000000000000..406d7d52e2e29d25ebba78fecaed36dc839e910a --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperPlaySoundConsumeEffect.java -@@ -0,0 +1,25 @@ +@@ -0,0 +1,22 @@ +package io.papermc.paper.datacomponent.item.consumable; + +import io.papermc.paper.adventure.PaperAdventure; +import net.kyori.adventure.key.Key; +import net.minecraft.world.item.consume_effects.PlaySoundConsumeEffect; -+import org.bukkit.craftbukkit.util.Handleable; +import org.checkerframework.checker.nullness.qual.NonNull; + -+import static io.papermc.paper.datacomponent.ComponentUtils.transform; -+ +public record PaperPlaySoundConsumeEffect( + PlaySoundConsumeEffect impl +) implements io.papermc.paper.datacomponent.item.consumable.PlaySoundConsumeEffect, PaperConsumableEffectImpl<PlaySoundConsumeEffect> { @@ -3807,26 +3783,18 @@ index 0000000000000000000000000000000000000000..6667a5dfd3de7f27dc6c35f95f3c3211 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperRemoveStatusEffectsConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperRemoveStatusEffectsConsumeEffect.java new file mode 100644 -index 0000000000000000000000000000000000000000..3d52af596a2ded9d5e9bc7e8acaaddd511490dcf +index 0000000000000000000000000000000000000000..81ce88451c550085eb792d1a05d9abd28f8a83da --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperRemoveStatusEffectsConsumeEffect.java -@@ -0,0 +1,30 @@ +@@ -0,0 +1,22 @@ +package io.papermc.paper.datacomponent.item.consumable; + -+import java.util.List; -+import io.papermc.paper.registry.PaperRegistries; +import io.papermc.paper.registry.RegistryKey; +import io.papermc.paper.registry.set.PaperRegistrySets; +import io.papermc.paper.registry.set.RegistryKeySet; -+import net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect; -+import org.bukkit.craftbukkit.potion.CraftPotionUtil; -+import org.bukkit.craftbukkit.util.Handleable; -+import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.checkerframework.checker.nullness.qual.NonNull; + -+import static io.papermc.paper.datacomponent.ComponentUtils.transform; -+ +public record PaperRemoveStatusEffectsConsumeEffect( + net.minecraft.world.item.consume_effects.RemoveStatusEffectsConsumeEffect impl +) implements RemoveStatusEffectsConsumeEffect, PaperConsumableEffectImpl<net.minecraft.world.item.consume_effects.RemoveStatusEffectsConsumeEffect> { @@ -3843,14 +3811,12 @@ index 0000000000000000000000000000000000000000..3d52af596a2ded9d5e9bc7e8acaaddd5 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperTeleportRandomlyConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperTeleportRandomlyConsumeEffect.java new file mode 100644 -index 0000000000000000000000000000000000000000..5985308cac8f9409eea478fb68f64e8cfd4855c9 +index 0000000000000000000000000000000000000000..724e889cd668191e0472f3f56d6833e5e2a566b9 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperTeleportRandomlyConsumeEffect.java -@@ -0,0 +1,17 @@ +@@ -0,0 +1,15 @@ +package io.papermc.paper.datacomponent.item.consumable; + -+import org.bukkit.craftbukkit.util.Handleable; -+ +public record PaperTeleportRandomlyConsumeEffect( + net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect impl +) implements TeleportRandomlyConsumeEffect, PaperConsumableEffectImpl<net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect> { @@ -4272,16 +4238,15 @@ index 0000000000000000000000000000000000000000..9fc9756aff2248d7684e20f37e920237 +} diff --git a/src/test/java/io/papermc/paper/item/ItemStackDataComponentTest.java b/src/test/java/io/papermc/paper/item/ItemStackDataComponentTest.java new file mode 100644 -index 0000000000000000000000000000000000000000..586f88b5bd5a7ce84d0dbd5e5bfa6a67d72089f6 +index 0000000000000000000000000000000000000000..e4d9f65ae99427bd3277c7de5da404bf101e3b79 --- /dev/null +++ b/src/test/java/io/papermc/paper/item/ItemStackDataComponentTest.java -@@ -0,0 +1,380 @@ +@@ -0,0 +1,374 @@ +package io.papermc.paper.item; + +import io.papermc.paper.datacomponent.DataComponentType; +import io.papermc.paper.datacomponent.DataComponentTypes; +import io.papermc.paper.datacomponent.item.ChargedProjectiles; -+import io.papermc.paper.datacomponent.item.Consumable; +import io.papermc.paper.datacomponent.item.CustomModelData; +import io.papermc.paper.datacomponent.item.DyedItemColor; +import io.papermc.paper.datacomponent.item.Fireworks; @@ -4296,9 +4261,6 @@ index 0000000000000000000000000000000000000000..586f88b5bd5a7ce84d0dbd5e5bfa6a67 +import io.papermc.paper.datacomponent.item.PotDecorations; +import io.papermc.paper.datacomponent.item.Tool; +import io.papermc.paper.datacomponent.item.Unbreakable; -+import io.papermc.paper.datacomponent.item.consumable.ApplyStatusEffectsConsumeEffect; -+import io.papermc.paper.datacomponent.item.consumable.ConsumeEffect; -+import io.papermc.paper.datacomponent.item.consumable.ItemUseAnimation; +import io.papermc.paper.registry.RegistryAccess; +import io.papermc.paper.registry.RegistryKey; +import io.papermc.paper.registry.set.RegistrySet; @@ -4337,8 +4299,6 @@ index 0000000000000000000000000000000000000000..586f88b5bd5a7ce84d0dbd5e5bfa6a67 +import org.bukkit.inventory.meta.trim.ArmorTrim; +import org.bukkit.inventory.meta.trim.TrimMaterial; +import org.bukkit.inventory.meta.trim.TrimPattern; -+import org.bukkit.potion.PotionEffect; -+import org.bukkit.potion.PotionEffectType; +import org.bukkit.support.environment.Normal; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; |