Class EnchantmentWrapper

java.lang.Object
org.bukkit.enchantments.Enchantment
me.manossef.api.wrappers.EnchantmentWrapper
All Implemented Interfaces:
org.bukkit.Keyed

public class EnchantmentWrapper extends org.bukkit.enchantments.Enchantment
This class contains the constructors used to construct custom enchantments, as well as the methods needed for those constructors.
  • Field Summary

    Fields inherited from class org.bukkit.enchantments.Enchantment

    ARROW_DAMAGE, ARROW_FIRE, ARROW_INFINITE, ARROW_KNOCKBACK, BINDING_CURSE, CHANNELING, DAMAGE_ALL, DAMAGE_ARTHROPODS, DAMAGE_UNDEAD, DEPTH_STRIDER, DIG_SPEED, DURABILITY, FIRE_ASPECT, FROST_WALKER, IMPALING, KNOCKBACK, LOOT_BONUS_BLOCKS, LOOT_BONUS_MOBS, LOYALTY, LUCK, LURE, MENDING, MULTISHOT, OXYGEN, PIERCING, PROTECTION_ENVIRONMENTAL, PROTECTION_EXPLOSIONS, PROTECTION_FALL, PROTECTION_FIRE, PROTECTION_PROJECTILE, QUICK_CHARGE, RIPTIDE, SILK_TOUCH, SOUL_SPEED, SWEEPING_EDGE, THORNS, VANISHING_CURSE, WATER_WORKER
  • Constructor Summary

    Constructors
    Constructor
    Description
    EnchantmentWrapper​(String key, String name, int maxLvl)
    Creates a new enchantment with a key in the "minecraft:" namespace, a name and a maximum level specified.
    EnchantmentWrapper​(String key, String name, int maxLvl, int startLvl)
    Creates a new enchantment with a key in the "minecraft:" namespace, a name, a maximum level and a starting level specified.
    EnchantmentWrapper​(String key, String name, int maxLvl, int startLvl, org.bukkit.enchantments.EnchantmentTarget itemTarget)
    Creates a new enchantment with a key in the "minecraft:" namespace, a name, a maximum level, a starting level and an item target specified.
    EnchantmentWrapper​(String key, String name, int maxLvl, int startLvl, org.bukkit.enchantments.EnchantmentTarget itemTarget, boolean isTreasure)
    Creates a new enchantment with a key in the "minecraft:" namespace, a name, a maximum level, a starting level and an item target specified, as well as whether it is a treasure enchantment.
    EnchantmentWrapper​(String key, String name, int maxLvl, int startLvl, org.bukkit.enchantments.EnchantmentTarget itemTarget, boolean isTreasure, boolean isCursed)
    Deprecated.
    This constructor uses isCursed, which makes no difference.
    EnchantmentWrapper​(org.bukkit.NamespacedKey key, String name, int maxLvl)
    Creates a new enchantment with a namespaced key, a name and a maximum level specified.
    EnchantmentWrapper​(org.bukkit.NamespacedKey key, String name, int maxLvl, int startLvl)
    Creates a new enchantment with a namespaced key, a name, a maximum level and a starting level specified.
    EnchantmentWrapper​(org.bukkit.NamespacedKey key, String name, int maxLvl, int startLvl, org.bukkit.enchantments.EnchantmentTarget itemTarget)
    Creates a new enchantment with a namespaced key, a name, a maximum level, a starting level and an item target specified.
    EnchantmentWrapper​(org.bukkit.NamespacedKey key, String name, int maxLvl, int startLvl, org.bukkit.enchantments.EnchantmentTarget itemTarget, boolean isTreasure)
    Creates a new enchantment with a namespaced key, a name, a maximum level, a starting level and an item target specified, as well as whether it is a treasure enchantment.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canEnchantItem​(org.bukkit.inventory.ItemStack item)
    Returns false since custom enchantments cannot be obtained through the enchanting table.
    boolean
    conflictsWith​(org.bukkit.enchantments.Enchantment ench)
    Returns false since the ItemStack.addUnsafeEnchantment(Enchantment, int) method is to be used in order to add custom enchantments to items.
    org.bukkit.enchantments.EnchantmentTarget
    Gets the type of ItemStack that may fit this enchantment.
    int
    Gets the maximum level of the enchantment.
    Gets the name of the enchantment.
    int
    Gets the level that this enchantment should start at.
    boolean
    Deprecated.
    According to the spigot API javadoc, cursed enchantments are no longer special.
    boolean
    Gets whether the enchantment is a treasure enchantment.

    Methods inherited from class org.bukkit.enchantments.Enchantment

    equals, getByKey, getByName, getKey, hashCode, isAcceptingRegistrations, registerEnchantment, stopAcceptingRegistrations, toString, values

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • EnchantmentWrapper

      public EnchantmentWrapper(String key, String name, int maxLvl)
      Creates a new enchantment with a key in the "minecraft:" namespace, a name and a maximum level specified.
      Parameters:
      key - the identifier of the enchantment, using "minecraft:" as the namespace. Must only contain lowercase letters, numbers, underscores, and hyphens (not recommended).
      name - the name of the enchantment. Basically the identifier but in sentence case.
      maxLvl - the maximum level of the enchantment.
    • EnchantmentWrapper

      public EnchantmentWrapper(String key, String name, int maxLvl, int startLvl)
      Creates a new enchantment with a key in the "minecraft:" namespace, a name, a maximum level and a starting level specified.
      Parameters:
      key - the identifier of the enchantment, using "minecraft:" as the namespace. Must only contain lowercase letters, numbers, underscores, and hyphens (not recommended).
      name - the name of the enchantment. Basically the identifier but in sentence case.
      maxLvl - the maximum level of the enchantment.
      startLvl - the level that this enchantment should start at.
    • EnchantmentWrapper

      public EnchantmentWrapper(String key, String name, int maxLvl, int startLvl, org.bukkit.enchantments.EnchantmentTarget itemTarget)
      Creates a new enchantment with a key in the "minecraft:" namespace, a name, a maximum level, a starting level and an item target specified.
      Parameters:
      key - the identifier of the enchantment, using "minecraft:" as the namespace. Must only contain lowercase letters, numbers, underscores, and hyphens (not recommended).
      name - the name of the enchantment. Basically the identifier but in sentence case.
      maxLvl - the maximum level of the enchantment.
      startLvl - the level that this enchantment should start at.
      itemTarget - the type of ItemStack that may fit this enchantment.
    • EnchantmentWrapper

      public EnchantmentWrapper(String key, String name, int maxLvl, int startLvl, org.bukkit.enchantments.EnchantmentTarget itemTarget, boolean isTreasure)
      Creates a new enchantment with a key in the "minecraft:" namespace, a name, a maximum level, a starting level and an item target specified, as well as whether it is a treasure enchantment.
      Parameters:
      key - the identifier of the enchantment, using "minecraft:" as the namespace. Must only contain lowercase letters, numbers, underscores, and hyphens (not recommended).
      name - the name of the enchantment. Basically the identifier but in sentence case.
      maxLvl - the maximum level of the enchantment.
      startLvl - the level that this enchantment should start at.
      itemTarget - the type of ItemStack that may fit this enchantment.
      isTreasure - whether the enchantment is a treasure enchantment.
    • EnchantmentWrapper

      @Deprecated public EnchantmentWrapper(String key, String name, int maxLvl, int startLvl, org.bukkit.enchantments.EnchantmentTarget itemTarget, boolean isTreasure, boolean isCursed)
      Deprecated.
      This constructor uses isCursed, which makes no difference.
      Creates a new enchantment with a key in the "minecraft:" namespace, a name, a maximum level, a starting level and an item target specified, as well as whether it is a treasure enchantment.
      Parameters:
      key - the identifier of the enchantment, using "minecraft:" as the namespace. Must only contain lowercase letters, numbers, underscores, and hyphens (not recommended).
      name - the name of the enchantment. Basically the identifier but in sentence case.
      maxLvl - the maximum level of the enchantment.
      startLvl - the level that this enchantment should start at.
      itemTarget - the type of ItemStack that may fit this enchantment.
      isTreasure - whether the enchantment is a treasure enchantment.
      isCursed - whether the enchantment is a cursed enchantment.
    • EnchantmentWrapper

      public EnchantmentWrapper(org.bukkit.NamespacedKey key, String name, int maxLvl)
      Creates a new enchantment with a namespaced key, a name and a maximum level specified.
      Parameters:
      key - the namespaced key of the enchantment.
      name - the name of the enchantment. Basically the identifier but in sentence case.
      maxLvl - the maximum level of the enchantment.
    • EnchantmentWrapper

      public EnchantmentWrapper(org.bukkit.NamespacedKey key, String name, int maxLvl, int startLvl)
      Creates a new enchantment with a namespaced key, a name, a maximum level and a starting level specified.
      Parameters:
      key - the namespaced key of the enchantment.
      name - the name of the enchantment. Basically the identifier but in sentence case.
      maxLvl - the maximum level of the enchantment.
      startLvl - the level that this enchantment should start at.
    • EnchantmentWrapper

      public EnchantmentWrapper(org.bukkit.NamespacedKey key, String name, int maxLvl, int startLvl, org.bukkit.enchantments.EnchantmentTarget itemTarget)
      Creates a new enchantment with a namespaced key, a name, a maximum level, a starting level and an item target specified.
      Parameters:
      key - the namespaced key of the enchantment.
      name - the name of the enchantment. Basically the identifier but in sentence case.
      maxLvl - the maximum level of the enchantment.
      startLvl - the level that this enchantment should start at.
      itemTarget - the type of ItemStack that may fit this enchantment.
    • EnchantmentWrapper

      public EnchantmentWrapper(org.bukkit.NamespacedKey key, String name, int maxLvl, int startLvl, org.bukkit.enchantments.EnchantmentTarget itemTarget, boolean isTreasure)
      Creates a new enchantment with a namespaced key, a name, a maximum level, a starting level and an item target specified, as well as whether it is a treasure enchantment.
      Parameters:
      key - the namespaced key of the enchantment.
      name - the name of the enchantment. Basically the identifier but in sentence case.
      maxLvl - the maximum level of the enchantment.
      startLvl - the level that this enchantment should start at.
      itemTarget - the type of ItemStack that may fit this enchantment.
      isTreasure - whether the enchantment is a treasure enchantment.
  • Method Details

    • canEnchantItem

      public boolean canEnchantItem(org.bukkit.inventory.ItemStack item)
      Returns false since custom enchantments cannot be obtained through the enchanting table.
      Specified by:
      canEnchantItem in class org.bukkit.enchantments.Enchantment
    • conflictsWith

      public boolean conflictsWith(org.bukkit.enchantments.Enchantment ench)
      Returns false since the ItemStack.addUnsafeEnchantment(Enchantment, int) method is to be used in order to add custom enchantments to items.
      Specified by:
      conflictsWith in class org.bukkit.enchantments.Enchantment
    • getItemTarget

      public org.bukkit.enchantments.EnchantmentTarget getItemTarget()
      Gets the type of ItemStack that may fit this enchantment.
      Specified by:
      getItemTarget in class org.bukkit.enchantments.Enchantment
    • getMaxLevel

      public int getMaxLevel()
      Gets the maximum level of the enchantment.
      Specified by:
      getMaxLevel in class org.bukkit.enchantments.Enchantment
    • getName

      public String getName()
      Gets the name of the enchantment.
      Specified by:
      getName in class org.bukkit.enchantments.Enchantment
    • getStartLevel

      public int getStartLevel()
      Gets the level that this enchantment should start at.
      Specified by:
      getStartLevel in class org.bukkit.enchantments.Enchantment
    • isTreasure

      public boolean isTreasure()
      Gets whether the enchantment is a treasure enchantment.
      Specified by:
      isTreasure in class org.bukkit.enchantments.Enchantment
    • isCursed

      @Deprecated public boolean isCursed()
      Deprecated.
      According to the spigot API javadoc, cursed enchantments are no longer special.
      Gets whether the enchantment is a cursed enchantment.
      Specified by:
      isCursed in class org.bukkit.enchantments.Enchantment