package me.youhavetrouble.enchantio.enchants; import io.papermc.paper.registry.data.EnchantmentRegistryEntry; import io.papermc.paper.registry.keys.tags.EnchantmentTagKeys; import io.papermc.paper.registry.tag.TagKey; import io.papermc.paper.tag.TagEntry; import net.kyori.adventure.key.Key; import net.kyori.adventure.text.Component; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.EquipmentSlotGroup; import org.bukkit.inventory.ItemType; import java.util.Collections; import java.util.HashSet; import java.util.Set; @SuppressWarnings("UnstableApiUsage") public class TelepathyEnchant implements EnchantioEnchant { public static final Key KEY = Key.key("enchantio:telepathy"); private final int anvilCost, weight; private final EnchantmentRegistryEntry.EnchantmentCost minimumCost; private final EnchantmentRegistryEntry.EnchantmentCost maximumCost; private final Set> supportedItemTags; private final Set> enchantTagKeys = new HashSet<>(); public TelepathyEnchant( int anvilCost, int weight, EnchantmentRegistryEntry.EnchantmentCost minimumCost, EnchantmentRegistryEntry.EnchantmentCost maximumCost, boolean canGetFromEnchantingTable, Set> supportedItemTags ) { this.anvilCost = anvilCost; this.weight = weight; this.minimumCost = minimumCost; this.maximumCost = maximumCost; this.supportedItemTags = supportedItemTags; if (canGetFromEnchantingTable) { enchantTagKeys.add(EnchantmentTagKeys.IN_ENCHANTING_TABLE); } } @Override public Key getKey() { return KEY; } @Override public Component getDescription() { return Component.translatable("enchantio.enchant.telepathy","Telepathy"); } @Override public int getAnvilCost() { return anvilCost; } @Override public int getMaxLevel() { return 1; } @Override public int getWeight() { return weight; } @Override public EnchantmentRegistryEntry.EnchantmentCost getMinimumCost() { return minimumCost; } @Override public EnchantmentRegistryEntry.EnchantmentCost getMaximumCost() { return maximumCost; } @Override public Iterable getActiveSlots() { return Set.of(EquipmentSlotGroup.HAND); } @Override public Set> getSupportedItems() { return supportedItemTags; } @Override public Set> getEnchantTagKeys() { return Collections.unmodifiableSet(enchantTagKeys); } }