Package org.bukkit.enchantments
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 selectingEnchantments
-
-
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, SWEEPING_EDGE, THORNS, VANISHING_CURSE, WATER_WORKER
-
-
Constructor Summary
Constructors Constructor Description EnchantmentWrapper(String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanEnchantItem(ItemStack item)Checks if this Enchantment may be applied to the givenItemStack.booleanconflictsWith(Enchantment other)Check if this enchantment conflicts with another enchantment.EnchantmentgetEnchantment()Gets the enchantment bound to this wrapperEnchantmentTargetgetItemTarget()Gets the type ofItemStackthat may fit this Enchantment.intgetMaxLevel()Gets the maximum level that this Enchantment may become.StringgetName()Gets the unique name of this enchantmentintgetStartLevel()Gets the level that this Enchantment should start atbooleanisCursed()Checks if this enchantment is a cursed enchantment
Cursed enchantments are found the same way treasure enchantments arebooleanisTreasure()Checks if this enchantment is a treasure enchantment.-
Methods inherited from class org.bukkit.enchantments.Enchantment
equals, getByKey, getByName, getKey, hashCode, isAcceptingRegistrations, registerEnchantment, stopAcceptingRegistrations, toString, values
-
-
-
-
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:EnchantmentGets the maximum level that this Enchantment may become.- Specified by:
getMaxLevelin classEnchantment- Returns:
- Maximum level of the Enchantment
-
getStartLevel
public int getStartLevel()
Description copied from class:EnchantmentGets the level that this Enchantment should start at- Specified by:
getStartLevelin classEnchantment- Returns:
- Starting level of the Enchantment
-
getItemTarget
@NotNull public EnchantmentTarget getItemTarget()
Description copied from class:EnchantmentGets the type ofItemStackthat may fit this Enchantment.- Specified by:
getItemTargetin classEnchantment- Returns:
- Target type of the Enchantment
-
canEnchantItem
public boolean canEnchantItem(@NotNull ItemStack item)Description copied from class:EnchantmentChecks if this Enchantment may be applied to the givenItemStack.This does not check if it conflicts with any enchantments already applied to the item.
- Specified by:
canEnchantItemin classEnchantment- Parameters:
item- Item to test- Returns:
- True if the enchantment may be applied, otherwise False
-
getName
@NotNull public String getName()
Description copied from class:EnchantmentGets the unique name of this enchantment- Specified by:
getNamein classEnchantment- Returns:
- Unique name
-
isTreasure
public boolean isTreasure()
Description copied from class:EnchantmentChecks if this enchantment is a treasure enchantment.
Treasure enchantments can only be received via looting, trading, or fishing.- Specified by:
isTreasurein classEnchantment- Returns:
- true if the enchantment is a treasure enchantment
-
isCursed
public boolean isCursed()
Description copied from class:EnchantmentChecks if this enchantment is a cursed enchantment
Cursed enchantments are found the same way treasure enchantments are- Specified by:
isCursedin classEnchantment- Returns:
- true if the enchantment is cursed
-
conflictsWith
public boolean conflictsWith(@NotNull Enchantment other)Description copied from class:EnchantmentCheck if this enchantment conflicts with another enchantment.- Specified by:
conflictsWithin classEnchantment- Parameters:
other- The enchantment to check against- Returns:
- True if there is a conflict.
-
-