Package me.manossef.api.wrappers
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
ConstructorsConstructorDescriptionEnchantmentWrapper(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 TypeMethodDescriptionbooleancanEnchantItem(org.bukkit.inventory.ItemStack item)Returns false since custom enchantments cannot be obtained through the enchanting table.booleanconflictsWith(org.bukkit.enchantments.Enchantment ench)Returns false since theItemStack.addUnsafeEnchantment(Enchantment, int)method is to be used in order to add custom enchantments to items.org.bukkit.enchantments.EnchantmentTargetGets the type ofItemStackthat may fit this enchantment.intGets the maximum level of the enchantment.getName()Gets the name of the enchantment.intGets the level that this enchantment should start at.booleanisCursed()Deprecated.According to the spigot API javadoc, cursed enchantments are no longer special.booleanGets 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
-
Constructor Details
-
EnchantmentWrapper
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
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 ofItemStackthat 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 ofItemStackthat 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 ofItemStackthat may fit this enchantment.isTreasure- whether the enchantment is a treasure enchantment.isCursed- whether the enchantment is a cursed enchantment.
-
EnchantmentWrapper
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
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 ofItemStackthat 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 ofItemStackthat 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:
canEnchantItemin classorg.bukkit.enchantments.Enchantment
-
conflictsWith
public boolean conflictsWith(org.bukkit.enchantments.Enchantment ench)Returns false since theItemStack.addUnsafeEnchantment(Enchantment, int)method is to be used in order to add custom enchantments to items.- Specified by:
conflictsWithin classorg.bukkit.enchantments.Enchantment
-
getItemTarget
public org.bukkit.enchantments.EnchantmentTarget getItemTarget()Gets the type ofItemStackthat may fit this enchantment.- Specified by:
getItemTargetin classorg.bukkit.enchantments.Enchantment
-
getMaxLevel
public int getMaxLevel()Gets the maximum level of the enchantment.- Specified by:
getMaxLevelin classorg.bukkit.enchantments.Enchantment
-
getName
Gets the name of the enchantment.- Specified by:
getNamein classorg.bukkit.enchantments.Enchantment
-
getStartLevel
public int getStartLevel()Gets the level that this enchantment should start at.- Specified by:
getStartLevelin classorg.bukkit.enchantments.Enchantment
-
isTreasure
public boolean isTreasure()Gets whether the enchantment is a treasure enchantment.- Specified by:
isTreasurein classorg.bukkit.enchantments.Enchantment
-
isCursed
Deprecated.According to the spigot API javadoc, cursed enchantments are no longer special.Gets whether the enchantment is a cursed enchantment.- Specified by:
isCursedin classorg.bukkit.enchantments.Enchantment
-