mirror of
https://github.com/YouHaveTrouble/Enchantio.git
synced 2026-05-12 06:06:55 +00:00
add ability to configure active slots for the enchant
This commit is contained in:
@@ -9,6 +9,7 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -24,6 +25,7 @@ public class AirbagEnchant implements EnchantioEnchant {
|
||||
private final EnchantmentRegistryEntry.EnchantmentCost maximumCost;
|
||||
private final Set<TagEntry<ItemType>> supportedItemTags;
|
||||
private final Set<TagKey<Enchantment>> enchantTagKeys = new HashSet<>();
|
||||
private final Set<EquipmentSlotGroup> activeSlots = new HashSet<>();
|
||||
private final double damageReductionPerLevel;
|
||||
|
||||
public AirbagEnchant(
|
||||
@@ -33,6 +35,7 @@ public class AirbagEnchant implements EnchantioEnchant {
|
||||
EnchantmentRegistryEntry.EnchantmentCost maximumCost,
|
||||
boolean canGetFromEnchantingTable,
|
||||
Set<TagEntry<ItemType>> supportedItemTags,
|
||||
Set<EquipmentSlotGroup> activeSlots,
|
||||
int maxLevel,
|
||||
double damageReductionPerLevel
|
||||
) {
|
||||
@@ -43,18 +46,19 @@ public class AirbagEnchant implements EnchantioEnchant {
|
||||
this.maximumCost = maximumCost;
|
||||
this.supportedItemTags = supportedItemTags;
|
||||
this.damageReductionPerLevel = damageReductionPerLevel;
|
||||
this.activeSlots.addAll(activeSlots);
|
||||
if (canGetFromEnchantingTable) {
|
||||
enchantTagKeys.add(EnchantmentTagKeys.IN_ENCHANTING_TABLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key getKey() {
|
||||
public @NotNull Key getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getDescription() {
|
||||
public @NotNull Component getDescription() {
|
||||
return Component.translatable("enchantio.enchant.airbag", "Airbag");
|
||||
}
|
||||
|
||||
@@ -74,27 +78,27 @@ public class AirbagEnchant implements EnchantioEnchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMinimumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMinimumCost() {
|
||||
return minimumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMaximumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMaximumCost() {
|
||||
return maximumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return Set.of(EquipmentSlotGroup.ARMOR);
|
||||
public @NotNull Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return activeSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
public @NotNull Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
return supportedItemTags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
public @NotNull Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
return Collections.unmodifiableSet(enchantTagKeys);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -26,6 +27,7 @@ public class BeheadingEnchant implements EnchantioEnchant {
|
||||
private final Set<TagEntry<ItemType>> supportedItemTags;
|
||||
private final double chanceToDropHeadPerLevel;
|
||||
private final Set<TagKey<Enchantment>> enchantTagKeys = new HashSet<>();
|
||||
private final Set<EquipmentSlotGroup> activeSlots = new HashSet<>();
|
||||
|
||||
public BeheadingEnchant(
|
||||
int anvilCost,
|
||||
@@ -34,6 +36,7 @@ public class BeheadingEnchant implements EnchantioEnchant {
|
||||
EnchantmentRegistryEntry.EnchantmentCost maximumCost,
|
||||
boolean canGetFromEnchantingTable,
|
||||
Set<TagEntry<ItemType>> supportedItemTags,
|
||||
Set<EquipmentSlotGroup> activeSlots,
|
||||
int maxLevel,
|
||||
double chanceToDropHeadPerLevel
|
||||
) {
|
||||
@@ -44,19 +47,19 @@ public class BeheadingEnchant implements EnchantioEnchant {
|
||||
this.supportedItemTags = supportedItemTags;
|
||||
this.maxLevel = maxLevel;
|
||||
this.chanceToDropHeadPerLevel = chanceToDropHeadPerLevel;
|
||||
|
||||
this.activeSlots.addAll(activeSlots);
|
||||
if (canGetFromEnchantingTable) {
|
||||
enchantTagKeys.add(EnchantmentTagKeys.IN_ENCHANTING_TABLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key getKey() {
|
||||
public @NotNull Key getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getDescription() {
|
||||
public @NotNull Component getDescription() {
|
||||
return Component.translatable("enchantio.enchant.beheading", "Beheading");
|
||||
}
|
||||
|
||||
@@ -80,32 +83,32 @@ public class BeheadingEnchant implements EnchantioEnchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMinimumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMinimumCost() {
|
||||
return minimumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMaximumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMaximumCost() {
|
||||
return maximumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return Set.of(EquipmentSlotGroup.ANY);
|
||||
public @NotNull Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return activeSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TagKey<ItemType> getTagForSupportedItems() {
|
||||
public @NotNull TagKey<ItemType> getTagForSupportedItems() {
|
||||
return TagKey.create(RegistryKey.ITEM, Key.key("enchantio:beheading_enchantable"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
public @NotNull Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
return supportedItemTags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
public @NotNull Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
return Collections.unmodifiableSet(enchantTagKeys);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,14 +10,17 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
public interface EnchantioEnchant {
|
||||
|
||||
@NotNull
|
||||
Key getKey();
|
||||
|
||||
@NotNull
|
||||
Component getDescription();
|
||||
|
||||
int getAnvilCost();
|
||||
@@ -26,20 +29,27 @@ public interface EnchantioEnchant {
|
||||
|
||||
int getWeight();
|
||||
|
||||
@NotNull
|
||||
EnchantmentRegistryEntry.EnchantmentCost getMinimumCost();
|
||||
|
||||
@NotNull
|
||||
EnchantmentRegistryEntry.EnchantmentCost getMaximumCost();
|
||||
|
||||
@NotNull
|
||||
Iterable<EquipmentSlotGroup> getActiveSlots();
|
||||
|
||||
@NotNull
|
||||
Set<TagEntry<ItemType>> getSupportedItems();
|
||||
|
||||
@NotNull
|
||||
Set<TagKey<Enchantment>> getEnchantTagKeys();
|
||||
|
||||
@NotNull
|
||||
default TagKey<ItemType> getTagForSupportedItems() {
|
||||
return TagKey.create(RegistryKey.ITEM, Key.key( getKey().asString() + "_enchantable"));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
default TagEntry<Enchantment> getTagEntry() {
|
||||
return TagEntry.valueEntry(TypedKey.create(RegistryKey.ENCHANTMENT, getKey()));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package me.youhavetrouble.enchantio.enchants;
|
||||
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.data.EnchantmentRegistryEntry;
|
||||
import io.papermc.paper.registry.keys.tags.EnchantmentTagKeys;
|
||||
import io.papermc.paper.registry.tag.TagKey;
|
||||
@@ -10,6 +9,7 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -26,6 +26,7 @@ public class ExecutionerEnchant implements EnchantioEnchant {
|
||||
private final Set<TagEntry<ItemType>> supportedItemTags;
|
||||
private final double damageMultiplierPerLevel, maxDamageHpThreshold;
|
||||
private final Set<TagKey<Enchantment>> enchantTagKeys = new HashSet<>();
|
||||
private final Set<EquipmentSlotGroup> activeSlots = new HashSet<>();
|
||||
|
||||
|
||||
public ExecutionerEnchant(
|
||||
@@ -35,6 +36,7 @@ public class ExecutionerEnchant implements EnchantioEnchant {
|
||||
EnchantmentRegistryEntry.EnchantmentCost maximumCost,
|
||||
boolean canGetFromEnchantingTable,
|
||||
Set<TagEntry<ItemType>> supportedItemTags,
|
||||
Set<EquipmentSlotGroup> activeSlots,
|
||||
int maxLevel,
|
||||
double damageMultiplierPerLevel,
|
||||
double maxDamageHpThreshold
|
||||
@@ -45,6 +47,7 @@ public class ExecutionerEnchant implements EnchantioEnchant {
|
||||
this.maximumCost = maximumCost;
|
||||
this.supportedItemTags = supportedItemTags;
|
||||
this.maxLevel = maxLevel;
|
||||
this.activeSlots.addAll(activeSlots);
|
||||
this.damageMultiplierPerLevel = damageMultiplierPerLevel;
|
||||
this.maxDamageHpThreshold = maxDamageHpThreshold;
|
||||
if (canGetFromEnchantingTable) {
|
||||
@@ -53,12 +56,12 @@ public class ExecutionerEnchant implements EnchantioEnchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key getKey() {
|
||||
public @NotNull Key getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getDescription() {
|
||||
public @NotNull Component getDescription() {
|
||||
return Component.translatable("enchantio.enchant.executioner","Executioner");
|
||||
}
|
||||
|
||||
@@ -86,27 +89,27 @@ public class ExecutionerEnchant implements EnchantioEnchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMinimumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMinimumCost() {
|
||||
return minimumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMaximumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMaximumCost() {
|
||||
return maximumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return Set.of(EquipmentSlotGroup.HAND);
|
||||
public @NotNull Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return activeSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
public @NotNull Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
return supportedItemTags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
public @NotNull Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
return Collections.unmodifiableSet(enchantTagKeys);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -25,6 +26,7 @@ public class PanicEnchant implements EnchantioEnchant {
|
||||
private final double panicChancePerLevel;
|
||||
private final Set<TagEntry<ItemType>> supportedItemTags;
|
||||
private final Set<TagKey<Enchantment>> enchantTagKeys = new HashSet<>();
|
||||
private final Set<EquipmentSlotGroup> activeSlots = new HashSet<>();
|
||||
|
||||
public PanicEnchant(
|
||||
int anvilCost,
|
||||
@@ -33,6 +35,7 @@ public class PanicEnchant implements EnchantioEnchant {
|
||||
EnchantmentRegistryEntry.EnchantmentCost maximumCost,
|
||||
boolean canGetFromEnchantingTable,
|
||||
Set<TagEntry<ItemType>> supportedItemTags,
|
||||
Set<EquipmentSlotGroup> activeSlots,
|
||||
int maxLevel,
|
||||
double panicChancePerLevel
|
||||
) {
|
||||
@@ -43,6 +46,7 @@ public class PanicEnchant implements EnchantioEnchant {
|
||||
this.maximumCost = maximumCost;
|
||||
this.supportedItemTags = supportedItemTags;
|
||||
this.panicChancePerLevel = panicChancePerLevel;
|
||||
this.activeSlots.addAll(activeSlots);
|
||||
if (canGetFromEnchantingTable) {
|
||||
enchantTagKeys.add(EnchantmentTagKeys.IN_ENCHANTING_TABLE);
|
||||
}
|
||||
@@ -50,12 +54,12 @@ public class PanicEnchant implements EnchantioEnchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key getKey() {
|
||||
public @NotNull Key getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getDescription() {
|
||||
public @NotNull Component getDescription() {
|
||||
return Component.translatable("enchantio.enchant.panic_curse", "Curse of Panic");
|
||||
}
|
||||
|
||||
@@ -75,27 +79,27 @@ public class PanicEnchant implements EnchantioEnchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMinimumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMinimumCost() {
|
||||
return minimumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMaximumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMaximumCost() {
|
||||
return maximumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return Set.of(EquipmentSlotGroup.ARMOR);
|
||||
public @NotNull Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return activeSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
public @NotNull Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
return supportedItemTags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
public @NotNull Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
return Collections.unmodifiableSet(enchantTagKeys);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -44,12 +45,12 @@ public class ReplantingEnchant implements EnchantioEnchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key getKey() {
|
||||
public @NotNull Key getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getDescription() {
|
||||
public @NotNull Component getDescription() {
|
||||
return Component.translatable("enchantio.enchant.replanting", "Replanting");
|
||||
}
|
||||
|
||||
@@ -69,27 +70,27 @@ public class ReplantingEnchant implements EnchantioEnchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMinimumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMinimumCost() {
|
||||
return minimumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMaximumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMaximumCost() {
|
||||
return maximumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return Set.of(EquipmentSlotGroup.HAND);
|
||||
public @NotNull Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return Set.of(EquipmentSlotGroup.MAINHAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
public @NotNull Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
return supportedItemTags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
public @NotNull Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
return Collections.unmodifiableSet(enchantTagKeys);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -44,12 +45,12 @@ public class SmeltingEnchant implements EnchantioEnchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key getKey() {
|
||||
public @NotNull Key getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getDescription() {
|
||||
public @NotNull Component getDescription() {
|
||||
return Component.translatable("enchantio.enchant.smelting", "Smelting");
|
||||
}
|
||||
|
||||
@@ -69,27 +70,27 @@ public class SmeltingEnchant implements EnchantioEnchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMinimumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMinimumCost() {
|
||||
return minimumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMaximumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMaximumCost() {
|
||||
return maximumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return Set.of(EquipmentSlotGroup.ANY);
|
||||
public @NotNull Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return Set.of(EquipmentSlotGroup.MAINHAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
public @NotNull Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
return supportedItemTags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
public @NotNull Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
return Collections.unmodifiableSet(enchantTagKeys);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -44,12 +45,12 @@ public class SoulboundEnchant implements EnchantioEnchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key getKey() {
|
||||
public @NotNull Key getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getDescription() {
|
||||
public @NotNull Component getDescription() {
|
||||
return Component.translatable("enchantio.enchant.soulbound", "Soulbound");
|
||||
}
|
||||
|
||||
@@ -69,27 +70,27 @@ public class SoulboundEnchant implements EnchantioEnchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMinimumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMinimumCost() {
|
||||
return minimumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMaximumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMaximumCost() {
|
||||
return maximumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
public @NotNull Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return Set.of(EquipmentSlotGroup.ANY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
public @NotNull Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
return supportedItemTags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
public @NotNull Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
return Collections.unmodifiableSet(enchantTagKeys);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -24,6 +25,7 @@ public class TelepathyEnchant implements EnchantioEnchant {
|
||||
private final EnchantmentRegistryEntry.EnchantmentCost maximumCost;
|
||||
private final Set<TagEntry<ItemType>> supportedItemTags;
|
||||
private final Set<TagKey<Enchantment>> enchantTagKeys = new HashSet<>();
|
||||
private final Set<EquipmentSlotGroup> activeSlots = new HashSet<>();
|
||||
|
||||
public TelepathyEnchant(
|
||||
int anvilCost,
|
||||
@@ -31,25 +33,27 @@ public class TelepathyEnchant implements EnchantioEnchant {
|
||||
EnchantmentRegistryEntry.EnchantmentCost minimumCost,
|
||||
EnchantmentRegistryEntry.EnchantmentCost maximumCost,
|
||||
boolean canGetFromEnchantingTable,
|
||||
Set<TagEntry<ItemType>> supportedItemTags
|
||||
Set<TagEntry<ItemType>> supportedItemTags,
|
||||
Set<EquipmentSlotGroup> activeSlots
|
||||
) {
|
||||
this.anvilCost = anvilCost;
|
||||
this.weight = weight;
|
||||
this.minimumCost = minimumCost;
|
||||
this.maximumCost = maximumCost;
|
||||
this.supportedItemTags = supportedItemTags;
|
||||
this.activeSlots.addAll(activeSlots);
|
||||
if (canGetFromEnchantingTable) {
|
||||
enchantTagKeys.add(EnchantmentTagKeys.IN_ENCHANTING_TABLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key getKey() {
|
||||
public @NotNull Key getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getDescription() {
|
||||
public @NotNull Component getDescription() {
|
||||
return Component.translatable("enchantio.enchant.telepathy","Telepathy");
|
||||
}
|
||||
|
||||
@@ -69,27 +73,27 @@ public class TelepathyEnchant implements EnchantioEnchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMinimumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMinimumCost() {
|
||||
return minimumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMaximumCost() {
|
||||
public EnchantmentRegistryEntry.@NotNull EnchantmentCost getMaximumCost() {
|
||||
return maximumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return Set.of(EquipmentSlotGroup.HAND);
|
||||
public @NotNull Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return activeSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
public @NotNull Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
return supportedItemTags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
public @NotNull Set<TagKey<Enchantment>> getEnchantTagKeys() {
|
||||
return Collections.unmodifiableSet(enchantTagKeys);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user