Package org.bukkit.enchantments
Class Enchantment
java.lang.Object
org.bukkit.enchantments.Enchantment
- All Implemented Interfaces:
- Keyed
- Direct Known Subclasses:
- EnchantmentWrapper
The various type of enchantments that may be added to armour or weapons
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final EnchantmentProvides extra damage when shooting arrows from bowsstatic final EnchantmentSets entities on fire when hit by arrows shot from a bowstatic final EnchantmentProvides infinite arrows when shooting a bowstatic final EnchantmentProvides a knockback when an entity is hit by an arrow from a bowstatic final EnchantmentItem cannot be removedstatic final EnchantmentStrikes lightning when a mob is hit with a trident if conditions are stormystatic final EnchantmentIncreases damage against all targetsstatic final EnchantmentIncreases damage against arthropod targetsstatic final EnchantmentIncreases damage against undead targetsstatic final EnchantmentIncreases walking speed while in waterstatic final EnchantmentIncreases the rate at which you mine/digstatic final EnchantmentDecreases the rate at which a tool looses durabilitystatic final EnchantmentWhen attacking a target, has a chance to set them on firestatic final EnchantmentFreezes any still water adjacent to ice / frost which player is walking onstatic final EnchantmentDeals more damage to mobs that live in the oceanstatic final EnchantmentAll damage to other targets will knock them back when hitstatic final EnchantmentProvides a chance of gaining extra loot when destroying blocksstatic final EnchantmentProvides a chance of gaining extra loot when killing monstersstatic final EnchantmentCauses a thrown trident to return to the player who threw itstatic final EnchantmentDecreases odds of catching worthless junkstatic final EnchantmentIncreases rate of fish biting your hookstatic final EnchantmentAllows mending the item using experience orbsstatic final EnchantmentShoot multiple arrows from crossbowsstatic final EnchantmentDecreases the rate of air loss whilst underwaterstatic final EnchantmentCrossbow projectiles pierce entitiesstatic final EnchantmentProvides protection against environmental damagestatic final EnchantmentProvides protection against explosive damagestatic final EnchantmentProvides protection against fall damagestatic final EnchantmentProvides protection against fire damagestatic final EnchantmentProvides protection against projectile damagestatic final EnchantmentCharges crossbows quicklystatic final EnchantmentWhen it is rainy, launches the player in the direction their trident is thrownstatic final EnchantmentAllows blocks to drop themselves instead of fragments (for example, stone instead of cobblestone)static final EnchantmentWalk quicker on soul blocksstatic final EnchantmentIncreases damage against targets when using a sweep attackstatic final EnchantmentDamages the attackerstatic final EnchantmentItem disappears instead of droppingstatic final EnchantmentIncreases the speed at which a player may mine underwater
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract booleancanEnchantItem(ItemStack item) Checks if this Enchantment may be applied to the givenItemStack.abstract booleanconflictsWith(Enchantment other) Check if this enchantment conflicts with another enchantment.booleanstatic EnchantmentgetByKey(NamespacedKey key) Gets the Enchantment at the specified keystatic EnchantmentDeprecated.abstract EnchantmentTargetGets the type ofItemStackthat may fit this Enchantment.getKey()Return the namespaced identifier for this object.abstract intGets the maximum level that this Enchantment may become.abstract StringgetName()Deprecated.enchantments are badly named, usegetKey().abstract intGets the level that this Enchantment should start atinthashCode()static booleanChecks if this is accepting Enchantment registrations.abstract booleanisCursed()Deprecated.cursed enchantments are no longer special.abstract booleanChecks if this enchantment is a treasure enchantment.static voidregisterEnchantment(Enchantment enchantment) Registers an enchantment with the given ID and object.static voidStops accepting any enchantment registrationstoString()static Enchantment[]values()Gets an array of all the registeredEnchantments
- 
Field Details- 
PROTECTION_ENVIRONMENTALProvides protection against environmental damage
- 
PROTECTION_FIREProvides protection against fire damage
- 
PROTECTION_FALLProvides protection against fall damage
- 
PROTECTION_EXPLOSIONSProvides protection against explosive damage
- 
PROTECTION_PROJECTILEProvides protection against projectile damage
- 
OXYGENDecreases the rate of air loss whilst underwater
- 
WATER_WORKERIncreases the speed at which a player may mine underwater
- 
THORNSDamages the attacker
- 
DEPTH_STRIDERIncreases walking speed while in water
- 
FROST_WALKERFreezes any still water adjacent to ice / frost which player is walking on
- 
BINDING_CURSEItem cannot be removed
- 
DAMAGE_ALLIncreases damage against all targets
- 
DAMAGE_UNDEADIncreases damage against undead targets
- 
DAMAGE_ARTHROPODSIncreases damage against arthropod targets
- 
KNOCKBACKAll damage to other targets will knock them back when hit
- 
FIRE_ASPECTWhen attacking a target, has a chance to set them on fire
- 
LOOT_BONUS_MOBSProvides a chance of gaining extra loot when killing monsters
- 
SWEEPING_EDGEIncreases damage against targets when using a sweep attack
- 
DIG_SPEEDIncreases the rate at which you mine/dig
- 
SILK_TOUCHAllows blocks to drop themselves instead of fragments (for example, stone instead of cobblestone)
- 
DURABILITYDecreases the rate at which a tool looses durability
- 
LOOT_BONUS_BLOCKSProvides a chance of gaining extra loot when destroying blocks
- 
ARROW_DAMAGEProvides extra damage when shooting arrows from bows
- 
ARROW_KNOCKBACKProvides a knockback when an entity is hit by an arrow from a bow
- 
ARROW_FIRESets entities on fire when hit by arrows shot from a bow
- 
ARROW_INFINITEProvides infinite arrows when shooting a bow
- 
LUCKDecreases odds of catching worthless junk
- 
LUREIncreases rate of fish biting your hook
- 
LOYALTYCauses a thrown trident to return to the player who threw it
- 
IMPALINGDeals more damage to mobs that live in the ocean
- 
RIPTIDEWhen it is rainy, launches the player in the direction their trident is thrown
- 
CHANNELINGStrikes lightning when a mob is hit with a trident if conditions are stormy
- 
MULTISHOTShoot multiple arrows from crossbows
- 
QUICK_CHARGECharges crossbows quickly
- 
PIERCINGCrossbow projectiles pierce entities
- 
MENDINGAllows mending the item using experience orbs
- 
VANISHING_CURSEItem disappears instead of dropping
- 
SOUL_SPEEDWalk quicker on soul blocks
 
- 
- 
Constructor Details- 
Enchantment
 
- 
- 
Method Details- 
getKeyDescription copied from interface:KeyedReturn the namespaced identifier for this object.
- 
getNameDeprecated.enchantments are badly named, usegetKey().Gets the unique name of this enchantment- Returns:
- Unique name
 
- 
getMaxLevelpublic abstract int getMaxLevel()Gets the maximum level that this Enchantment may become.- Returns:
- Maximum level of the Enchantment
 
- 
getStartLevelpublic abstract int getStartLevel()Gets the level that this Enchantment should start at- Returns:
- Starting level of the Enchantment
 
- 
getItemTargetGets the type ofItemStackthat may fit this Enchantment.- Returns:
- Target type of the Enchantment
 
- 
isTreasurepublic abstract boolean isTreasure()Checks if this enchantment is a treasure enchantment.
 Treasure enchantments can only be received via looting, trading, or fishing.- Returns:
- true if the enchantment is a treasure enchantment
 
- 
isCursedDeprecated.cursed enchantments are no longer special. Will return true only forBINDING_CURSEandVANISHING_CURSE.Checks if this enchantment is a cursed enchantment
 Cursed enchantments are found the same way treasure enchantments are- Returns:
- true if the enchantment is cursed
 
- 
conflictsWithCheck if this enchantment conflicts with another enchantment.- Parameters:
- other- The enchantment to check against
- Returns:
- True if there is a conflict.
 
- 
canEnchantItemChecks if this Enchantment may be applied to the givenItemStack.This does not check if it conflicts with any enchantments already applied to the item. - Parameters:
- item- Item to test
- Returns:
- True if the enchantment may be applied, otherwise False
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
- 
registerEnchantmentRegisters an enchantment with the given ID and object.Generally not to be used from within a plugin. - Parameters:
- enchantment- Enchantment to register
 
- 
isAcceptingRegistrationspublic static boolean isAcceptingRegistrations()Checks if this is accepting Enchantment registrations.- Returns:
- True if the server Implementation may add enchantments
 
- 
stopAcceptingRegistrationspublic static void stopAcceptingRegistrations()Stops accepting any enchantment registrations
- 
getByKeyGets the Enchantment at the specified key- Parameters:
- key- key to fetch
- Returns:
- Resulting Enchantment, or null if not found
 
- 
getByName@Deprecated @Contract("null -> null") @Nullable public static Enchantment getByName(@Nullable String name) Deprecated.enchantments are badly named, usegetByKey(org.bukkit.NamespacedKey).Gets the Enchantment at the specified name- Parameters:
- name- Name to fetch
- Returns:
- Resulting Enchantment, or null if not found
 
- 
valuesGets an array of all the registeredEnchantments- Returns:
- Array of enchantments
 
 
- 
getByKey(org.bukkit.NamespacedKey).