This commit is contained in:
2024-10-19 20:26:15 +02:00
parent 61ed32ccfa
commit 64d6d1929d
4 changed files with 19 additions and 25 deletions
@@ -2,7 +2,6 @@ package me.youhavetrouble.enchantio;
import io.papermc.paper.plugin.bootstrap.BootstrapContext; import io.papermc.paper.plugin.bootstrap.BootstrapContext;
import io.papermc.paper.plugin.bootstrap.PluginBootstrap; import io.papermc.paper.plugin.bootstrap.PluginBootstrap;
import io.papermc.paper.plugin.bootstrap.PluginProviderContext;
import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents; import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents;
import io.papermc.paper.registry.RegistryKey; import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
@@ -14,13 +13,12 @@ import me.youhavetrouble.enchantio.enchants.EnchantioEnchant;
import me.youhavetrouble.enchantio.enchants.SoulboundEnchant; import me.youhavetrouble.enchantio.enchants.SoulboundEnchant;
import me.youhavetrouble.enchantio.enchants.TelepathyEnchant; import me.youhavetrouble.enchantio.enchants.TelepathyEnchant;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@SuppressWarnings("all") @SuppressWarnings("UnstableApiUsage")
public class EnchantioBootstrap implements PluginBootstrap { public class EnchantioBootstrap implements PluginBootstrap {
@Override @Override
public void bootstrap(@NotNull BootstrapContext context) { public void bootstrap(@NotNull BootstrapContext context) {
@@ -65,8 +63,4 @@ public class EnchantioBootstrap implements PluginBootstrap {
} }
@Override
public @NotNull JavaPlugin createPlugin(@NotNull PluginProviderContext context) {
return PluginBootstrap.super.createPlugin(context);
}
} }
@@ -11,37 +11,35 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.EquipmentSlotGroup; import org.bukkit.inventory.EquipmentSlotGroup;
import org.bukkit.inventory.ItemType; import org.bukkit.inventory.ItemType;
import java.util.Collections;
import java.util.Map;
import java.util.Set; import java.util.Set;
@SuppressWarnings("all") @SuppressWarnings("UnstableApiUsage")
public interface EnchantioEnchant { public interface EnchantioEnchant {
public Key getKey(); Key getKey();
public Component getDescription(); Component getDescription();
public int getAnvilCost(); int getAnvilCost();
public int getMaxLevel(); int getMaxLevel();
public int getWeight(); int getWeight();
public EnchantmentRegistryEntry.EnchantmentCost getMinimumCost(); EnchantmentRegistryEntry.EnchantmentCost getMinimumCost();
public EnchantmentRegistryEntry.EnchantmentCost getMaximumCost(); EnchantmentRegistryEntry.EnchantmentCost getMaximumCost();
public Iterable<EquipmentSlotGroup> getActiveSlots(); Iterable<EquipmentSlotGroup> getActiveSlots();
public boolean canGetFromEnchantingTable(); boolean canGetFromEnchantingTable();
public default TagEntry<Enchantment> getTagEntry() { TagKey<ItemType> getTagForSupportedItems();
Set<TagEntry<ItemType>> getSupportedItems();
default TagEntry<Enchantment> getTagEntry() {
return TagEntry.valueEntry(TypedKey.create(RegistryKey.ENCHANTMENT, getKey())); return TagEntry.valueEntry(TypedKey.create(RegistryKey.ENCHANTMENT, getKey()));
} }
public TagKey<ItemType> getTagForSupportedItems();
public Set<TagEntry<ItemType>> getSupportedItems();
} }
@@ -12,6 +12,7 @@ import org.bukkit.inventory.ItemType;
import java.util.Set; import java.util.Set;
@SuppressWarnings("UnstableApiUsage")
public class SoulboundEnchant implements EnchantioEnchant { public class SoulboundEnchant implements EnchantioEnchant {
public static final Key KEY = Key.key("enchantio:soulbound"); public static final Key KEY = Key.key("enchantio:soulbound");
@@ -12,6 +12,7 @@ import org.bukkit.inventory.ItemType;
import java.util.Set; import java.util.Set;
@SuppressWarnings("UnstableApiUsage")
public class TelepathyEnchant implements EnchantioEnchant { public class TelepathyEnchant implements EnchantioEnchant {
public static final Key KEY = Key.key("enchantio:telepathy"); public static final Key KEY = Key.key("enchantio:telepathy");