Class EnchantmentWrapper

java.lang.Object
org.bukkit.enchantments.Enchantment
org.bukkit.enchantments.EnchantmentWrapper
All Implemented Interfaces:
Keyed

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

  • Method Details

    • getEnchantment

      @NotNull public @NotNull 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
    • getItemTarget

      @NotNull public @NotNull EnchantmentTarget getItemTarget()
      Description copied from class: Enchantment
      Gets the type of ItemStack that may fit this Enchantment.
      Specified by:
      getItemTarget in class Enchantment
      Returns:
      Target type of the Enchantment
    • canEnchantItem

      public boolean canEnchantItem(@NotNull @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 @NotNull 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 @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.
    • displayName

      @NotNull public Component displayName(int level)
      Description copied from class: Enchantment
      Get the name of the enchantment with its applied level.

      If the given level is either less than the Enchantment.getStartLevel() or greater than the Enchantment.getMaxLevel(), the level may not be shown in the numeral format one may otherwise expect.

      Specified by:
      displayName in class Enchantment
      Parameters:
      level - the level of the enchantment to show
      Returns:
      the name of the enchantment with level applied
    • isTradeable

      public boolean isTradeable()
      Description copied from class: Enchantment
      Checks if this enchantment can be found in villager trades.
      Specified by:
      isTradeable in class Enchantment
      Returns:
      true if the enchantment can be found in trades
    • isDiscoverable

      public boolean isDiscoverable()
      Description copied from class: Enchantment
      Checks if this enchantment can be found in an enchanting table or use to enchant items generated by loot tables.
      Specified by:
      isDiscoverable in class Enchantment
      Returns:
      true if the enchantment can be found in a table or by loot tables
    • getRarity

      @NotNull public EnchantmentRarity getRarity()
      Description copied from class: Enchantment
      Gets the rarity of this enchantment.
      Specified by:
      getRarity in class Enchantment
      Returns:
      the rarity
    • getDamageIncrease

      public float getDamageIncrease(int level, @NotNull EntityCategory entityCategory)
      Description copied from class: Enchantment
      Gets the damage increase as a result of the level and entity category specified
      Specified by:
      getDamageIncrease in class Enchantment
      Parameters:
      level - the level of enchantment
      entityCategory - the category of entity
      Returns:
      the damage increase
    • getActiveSlots

      @NotNull public Set<EquipmentSlot> getActiveSlots()
      Description copied from class: Enchantment
      Gets the equipment slots where this enchantment is considered "active".
      Specified by:
      getActiveSlots in class Enchantment
      Returns:
      the equipment slots