Class EnchantmentWrapper

  • All Implemented Interfaces:
    Keyed

    public class EnchantmentWrapper
    extends Enchantment
    A simple wrapper for ease of selecting Enchantments
    • Constructor Detail

      • EnchantmentWrapper

        public EnchantmentWrapper​(@NotNull
                                  String name)
    • Method Detail

      • getEnchantment

        @NotNull
        public Enchantment getEnchantment()
        Gets the enchantment bound to this wrapper
        Returns:
        Enchantment
      • getMaxLevel

        public int getMaxLevel()
        Description copied from class: Enchantment
        Gets the maximum level that this Enchantment may become.
        Specified by:
        getMaxLevel in class Enchantment
        Returns:
        Maximum level of the Enchantment
      • getStartLevel

        public int getStartLevel()
        Description copied from class: Enchantment
        Gets the level that this Enchantment should start at
        Specified by:
        getStartLevel in class Enchantment
        Returns:
        Starting level of the Enchantment
      • canEnchantItem

        public boolean canEnchantItem​(@NotNull
                                      ItemStack item)
        Description copied from class: Enchantment
        Checks if this Enchantment may be applied to the given ItemStack.

        This does not check if it conflicts with any enchantments already applied to the item.

        Specified by:
        canEnchantItem in class Enchantment
        Parameters:
        item - Item to test
        Returns:
        True if the enchantment may be applied, otherwise False
      • getName

        @NotNull
        public String getName()
        Description copied from class: Enchantment
        Gets the unique name of this enchantment
        Specified by:
        getName in class Enchantment
        Returns:
        Unique name
      • isTreasure

        public boolean isTreasure()
        Description copied from class: Enchantment
        Checks if this enchantment is a treasure enchantment.
        Treasure enchantments can only be received via looting, trading, or fishing.
        Specified by:
        isTreasure in class Enchantment
        Returns:
        true if the enchantment is a treasure enchantment
      • isCursed

        public boolean isCursed()
        Description copied from class: Enchantment
        Checks if this enchantment is a cursed enchantment
        Cursed enchantments are found the same way treasure enchantments are
        Specified by:
        isCursed in class Enchantment
        Returns:
        true if the enchantment is cursed
      • conflictsWith

        public boolean conflictsWith​(@NotNull
                                     Enchantment other)
        Description copied from class: Enchantment
        Check if this enchantment conflicts with another enchantment.
        Specified by:
        conflictsWith in class Enchantment
        Parameters:
        other - The enchantment to check against
        Returns:
        True if there is a conflict.