Finish converting most of the undeprecated api to jspecify
This commit is contained in:
@@ -40,18 +40,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import org.bukkit.enchantments.Enchantment;
|
||||
+import org.bukkit.inventory.EquipmentSlotGroup;
|
||||
+import org.bukkit.inventory.ItemType;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Range;
|
||||
+import org.jetbrains.annotations.Unmodifiable;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * A data-centric version-specific registry entry for the {@link Enchantment} type.
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface EnchantmentRegistryEntry {
|
||||
+
|
||||
@@ -61,14 +61,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @return the description component.
|
||||
+ */
|
||||
+ @NonNull Component description();
|
||||
+ Component description();
|
||||
+
|
||||
+ /**
|
||||
+ * Provides the registry key set referencing the items this enchantment is supported on.
|
||||
+ *
|
||||
+ * @return the registry key set.
|
||||
+ */
|
||||
+ @NonNull RegistryKeySet<ItemType> supportedItems();
|
||||
+ RegistryKeySet<ItemType> supportedItems();
|
||||
+
|
||||
+ /**
|
||||
+ * Provides the registry key set referencing the item types this enchantment can be applied to when
|
||||
@@ -106,7 +106,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @see <a href="https://minecraft.wiki/w/Enchanting/Levels">https://minecraft.wiki/w/Enchanting/Levels</a> for
|
||||
+ * examplary costs.
|
||||
+ */
|
||||
+ @NonNull EnchantmentCost minimumCost();
|
||||
+ EnchantmentCost minimumCost();
|
||||
+
|
||||
+ /**
|
||||
+ * Provides the maximum cost allowed to enchant an item with this enchantment.
|
||||
@@ -117,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @see <a href="https://minecraft.wiki/w/Enchanting/Levels">https://minecraft.wiki/w/Enchanting/Levels</a> for
|
||||
+ * examplary costs.
|
||||
+ */
|
||||
+ @NonNull EnchantmentCost maximumCost();
|
||||
+ EnchantmentCost maximumCost();
|
||||
+
|
||||
+ /**
|
||||
+ * Provides the cost of applying this enchantment using an anvil.
|
||||
@@ -140,7 +140,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @return a list of equipment slot groups.
|
||||
+ * @see Enchantment#getActiveSlotGroups()
|
||||
+ */
|
||||
+ @NonNull @Unmodifiable List<EquipmentSlotGroup> activeSlots();
|
||||
+ @Unmodifiable List<EquipmentSlotGroup> activeSlots();
|
||||
+
|
||||
+ /**
|
||||
+ * Provides the registry key set of enchantments that this enchantment is exclusive with.
|
||||
@@ -150,7 +150,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @return a registry set of enchantments exclusive to this one.
|
||||
+ */
|
||||
+ @NonNull RegistryKeySet<Enchantment> exclusiveWith();
|
||||
+ RegistryKeySet<Enchantment> exclusiveWith();
|
||||
+
|
||||
+ /**
|
||||
+ * A mutable builder for the {@link EnchantmentRegistryEntry} plugins may change in applicable registry events.
|
||||
@@ -179,7 +179,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @return this builder.
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ @NonNull Builder description(@NonNull Component description);
|
||||
+ Builder description(Component description);
|
||||
+
|
||||
+ /**
|
||||
+ * Configures the set of supported items this enchantment can be applied on. This
|
||||
@@ -195,7 +195,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @see io.papermc.paper.registry.event.RegistryFreezeEvent#getOrCreateTag(TagKey)
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ @NonNull Builder supportedItems(@NonNull RegistryKeySet<ItemType> supportedItems);
|
||||
+ Builder supportedItems(RegistryKeySet<ItemType> supportedItems);
|
||||
+
|
||||
+ /**
|
||||
+ * Configures a set of item types this enchantment can naturally be applied to, when enchanting in an
|
||||
@@ -216,7 +216,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @see io.papermc.paper.registry.event.RegistryFreezeEvent#getOrCreateTag(TagKey)
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ @NonNull Builder primaryItems(@Nullable RegistryKeySet<ItemType> primaryItems);
|
||||
+ Builder primaryItems(@Nullable RegistryKeySet<ItemType> primaryItems);
|
||||
+
|
||||
+ /**
|
||||
+ * Configures the weight of this enchantment used by the weighted random when selecting enchantments.
|
||||
@@ -226,7 +226,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @see <a href="https://minecraft.wiki/w/Enchanting">https://minecraft.wiki/w/Enchanting</a> for examplary weights.
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ @NonNull Builder weight(@Range(from = 1, to = 1024) int weight);
|
||||
+ Builder weight(@Range(from = 1, to = 1024) int weight);
|
||||
+
|
||||
+ /**
|
||||
+ * Configures the maximum level this enchantment can have when applied.
|
||||
@@ -235,7 +235,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @return this builder.
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ @NonNull Builder maxLevel(@Range(from = 1, to = 255) int maxLevel);
|
||||
+ Builder maxLevel(@Range(from = 1, to = 255) int maxLevel);
|
||||
+
|
||||
+ /**
|
||||
+ * Configures the minimum cost needed to enchant an item with this enchantment.
|
||||
@@ -248,7 +248,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * examplary costs.
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ @NonNull Builder minimumCost(@NotNull EnchantmentCost minimumCost);
|
||||
+ Builder minimumCost(EnchantmentCost minimumCost);
|
||||
+
|
||||
+ /**
|
||||
+ * Configures the maximum cost to enchant an item with this enchantment.
|
||||
@@ -261,7 +261,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * examplary costs.
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ @NonNull Builder maximumCost(@NotNull EnchantmentCost maximumCost);
|
||||
+ Builder maximumCost(EnchantmentCost maximumCost);
|
||||
+
|
||||
+ /**
|
||||
+ * Configures the cost of applying this enchantment using an anvil.
|
||||
@@ -275,7 +275,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @see Enchantment#getAnvilCost()
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ @NonNull Builder anvilCost(@Range(from = 0, to = Integer.MAX_VALUE) int anvilCost);
|
||||
+ Builder anvilCost(@Range(from = 0, to = Integer.MAX_VALUE) int anvilCost);
|
||||
+
|
||||
+ /**
|
||||
+ * Configures the list of slot groups this enchantment may be active in.
|
||||
@@ -288,7 +288,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @see Enchantment#getActiveSlotGroups()
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ default @NonNull Builder activeSlots(final @NonNull EquipmentSlotGroup @NonNull... activeSlots) {
|
||||
+ default Builder activeSlots(final EquipmentSlotGroup... activeSlots) {
|
||||
+ return this.activeSlots(List.of(activeSlots));
|
||||
+ }
|
||||
+
|
||||
@@ -303,7 +303,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @see Enchantment#getActiveSlotGroups()
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ @NonNull Builder activeSlots(@NonNull Iterable<@NonNull EquipmentSlotGroup> activeSlots);
|
||||
+ Builder activeSlots(Iterable<EquipmentSlotGroup> activeSlots);
|
||||
+
|
||||
+ /**
|
||||
+ * Configures the registry key set of enchantments that this enchantment is exclusive with.
|
||||
@@ -319,7 +319,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @see io.papermc.paper.registry.event.RegistryFreezeEvent#getOrCreateTag(TagKey)
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ @NonNull Builder exclusiveWith(@NonNull RegistryKeySet<Enchantment> exclusiveWith);
|
||||
+ Builder exclusiveWith(RegistryKeySet<Enchantment> exclusiveWith);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@@ -345,7 +345,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ /**
|
||||
+ * Creates a new enchantment cost instance based on the passed values.
|
||||
+ *
|
||||
+ * @param baseCost the base cost of the enchantment cost as returned by {@link #baseCost()}
|
||||
+ * @param baseCost the base cost of the enchantment cost as returned by {@link #baseCost()}
|
||||
+ * @param additionalPerLevelCost the additional cost per level, as returned by {@link #additionalPerLevelCost()}
|
||||
+ * @return the created instance.
|
||||
+ */
|
||||
@@ -369,15 +369,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+import io.papermc.paper.registry.RegistryBuilder;
|
||||
+import org.bukkit.GameEvent;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.Range;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * A data-centric version-specific registry entry for the {@link GameEvent} type.
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface GameEventRegistryEntry {
|
||||
+
|
||||
@@ -410,7 +411,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @see GameEvent#getRange()
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ @NonNull Builder range(@Range(from = 0, to = Integer.MAX_VALUE) int range);
|
||||
+ Builder range(@Range(from = 0, to = Integer.MAX_VALUE) int range);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/registry/data/package-info.java b/src/main/java/io/papermc/paper/registry/data/package-info.java
|
||||
@@ -441,14 +442,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import org.bukkit.GameEvent;
|
||||
+import org.bukkit.enchantments.Enchantment;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
+import static io.papermc.paper.registry.event.RegistryEventProviderImpl.create;
|
||||
+
|
||||
/**
|
||||
* Holds providers for {@link RegistryEntryAddEvent} and {@link RegistryFreezeEvent}
|
||||
* handlers for each applicable registry.
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
@ApiStatus.Experimental
|
||||
@@ -0,0 +0,0 @@ import org.jspecify.annotations.NullMarked;
|
||||
@NullMarked
|
||||
public final class RegistryEvents {
|
||||
|
||||
+ public static final RegistryEventProvider<GameEvent, GameEventRegistryEntry.Builder> GAME_EVENT = create(RegistryKey.GAME_EVENT);
|
||||
|
||||
Reference in New Issue
Block a user