Package org.bukkit.enchantments
Class Enchantment
java.lang.Object
org.bukkit.enchantments.Enchantment
- All Implemented Interfaces:
- Keyed,- RegistryAware,- Translatable
- Direct Known Subclasses:
- EnchantmentWrapper
The various type of enchantments that may be added to armour or weapons
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final EnchantmentIncreases the speed at which a player may mine underwaterstatic final EnchantmentIncreases damage against arthropod targetsstatic final EnchantmentItem cannot be removedstatic final EnchantmentProvides protection against explosive damagestatic final EnchantmentReduces armor effectiveness against macesstatic final EnchantmentStrikes lightning when a mob is hit with a trident if conditions are stormystatic final EnchantmentIncreases fall damage of macesstatic final EnchantmentIncreases walking speed while in waterstatic final EnchantmentIncreases the rate at which you mine/digstatic final EnchantmentProvides protection against fall damagestatic final EnchantmentWhen attacking a target, has a chance to set them on firestatic final EnchantmentProvides protection against fire damagestatic final EnchantmentSets entities on fire when hit by arrows shot from a bowstatic final EnchantmentProvides a chance of gaining extra loot when destroying blocksstatic 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 EnchantmentProvides infinite arrows when shooting a bowstatic final EnchantmentAll damage to other targets will knock them back when hitstatic 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 EnchantmentCrossbow projectiles pierce entitiesstatic final EnchantmentProvides extra damage when shooting arrows from bowsstatic final EnchantmentProvides protection against projectile damagestatic final EnchantmentProvides protection against environmental damagestatic final EnchantmentProvides a knockback when an entity is hit by an arrow from a bowstatic final EnchantmentCharges crossbows quicklystatic final EnchantmentDecreases the rate of air loss whilst underwaterstatic final EnchantmentWhen it is rainy, launches the player in the direction their trident is thrownstatic final EnchantmentIncreases damage against all targetsstatic final EnchantmentAllows blocks to drop themselves instead of fragments (for example, stone instead of cobblestone)static final EnchantmentIncreases damage against undead targetsstatic final EnchantmentWalk quicker on soul blocksstatic final EnchantmentIncreases damage against targets when using a sweep attackstatic final EnchantmentWalk quicker while sneakingstatic final EnchantmentDamages the attackerstatic final EnchantmentDecreases the rate at which a tool looses durabilitystatic final EnchantmentItem disappears instead of droppingstatic final EnchantmentEmits wind burst upon hitting enemy
- 
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.static EnchantmentgetByKey(NamespacedKey key) Deprecated.static EnchantmentDeprecated.enchantments are badly named, usegetByKey(org.bukkit.NamespacedKey).abstract EnchantmentTargetDeprecated.enchantment groupings are now managed by tags, not categoriesabstract NamespacedKeygetKey()Deprecated.A key might not always be present, useRegistryAware.getKeyOrThrow()instead.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 atabstract booleanisCursed()Deprecated.cursed enchantments are no longer special.abstract booleanDeprecated.enchantment types are now managed by tagsstatic Enchantment[]values()Deprecated.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bukkit.registry.RegistryAwaregetKeyOrNull, getKeyOrThrow, isRegisteredMethods inherited from interface org.bukkit.TranslatablegetTranslationKey
- 
Field Details- 
PROTECTIONProvides protection against environmental damage
- 
FIRE_PROTECTIONProvides protection against fire damage
- 
FEATHER_FALLINGProvides protection against fall damage
- 
BLAST_PROTECTIONProvides protection against explosive damage
- 
PROJECTILE_PROTECTIONProvides protection against projectile damage
- 
RESPIRATIONDecreases the rate of air loss whilst underwater
- 
AQUA_AFFINITYIncreases 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
- 
SHARPNESSIncreases damage against all targets
- 
SMITEIncreases damage against undead targets
- 
BANE_OF_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
- 
LOOTINGProvides a chance of gaining extra loot when killing monsters
- 
SWEEPING_EDGEIncreases damage against targets when using a sweep attack
- 
EFFICIENCYIncreases the rate at which you mine/dig
- 
SILK_TOUCHAllows blocks to drop themselves instead of fragments (for example, stone instead of cobblestone)
- 
UNBREAKINGDecreases the rate at which a tool looses durability
- 
FORTUNEProvides a chance of gaining extra loot when destroying blocks
- 
POWERProvides extra damage when shooting arrows from bows
- 
PUNCHProvides a knockback when an entity is hit by an arrow from a bow
- 
FLAMESets entities on fire when hit by arrows shot from a bow
- 
INFINITYProvides infinite arrows when shooting a bow
- 
LUCK_OF_THE_SEADecreases 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
- 
DENSITYIncreases fall damage of maces
- 
BREACHReduces armor effectiveness against maces
- 
WIND_BURSTEmits wind burst upon hitting enemy
- 
MENDINGAllows mending the item using experience orbs
- 
VANISHING_CURSEItem disappears instead of dropping
- 
SOUL_SPEEDWalk quicker on soul blocks
- 
SWIFT_SNEAKWalk quicker while sneaking
 
- 
- 
Constructor Details- 
Enchantmentpublic Enchantment()
 
- 
- 
Method Details- 
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
 
- 
getItemTargetDeprecated.enchantment groupings are now managed by tags, not categoriesGets the type ofItemStackthat may fit this Enchantment.- Returns:
- Target type of the Enchantment
 
- 
isTreasureDeprecated.enchantment types are now managed by tagsChecks 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
 
- 
getKeyDeprecated.A key might not always be present, useRegistryAware.getKeyOrThrow()instead.Return the namespaced identifier for this object.
- 
getByKey@Contract("null -> null") @Nullable @Deprecated(since="1.20.3") public static Enchantment getByKey(@Nullable NamespacedKey key) Deprecated.only for backwards compatibility, useRegistry.get(NamespacedKey)insteadGets the Enchantment at the specified key- Parameters:
- key- key to fetch
- Returns:
- Resulting Enchantment, or null if not found
 
- 
getByName@Deprecated(since="1.13") @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
 
- 
valuesDeprecated.Gets an array of all the registeredEnchantments- Returns:
- Array of enchantments
 
 
- 
Registry.get(NamespacedKey)instead