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 Summary
FieldsModifier 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 EnchantmentWalk quicker while sneakingstatic final EnchantmentDamages the attackerstatic final EnchantmentItem disappears instead of droppingstatic final EnchantmentIncreases the speed at which a player may mine underwater -
Constructor Summary
Constructors -
Method Summary
Modifier 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 EnchantmentTargetGets the type ofItemStackthat may fit this Enchantment.abstract intGets the maximum level that this Enchantment may become.abstract StringgetName()Deprecated.enchantments are badly named, useKeyed.getKey().abstract intGets the level that this Enchantment should start atabstract booleanisCursed()Deprecated.cursed enchantments are no longer special.abstract booleanChecks if this enchantment is a treasure enchantment.static Enchantment[]values()Deprecated.
-
Field Details
-
PROTECTION_ENVIRONMENTAL
Provides protection against environmental damage -
PROTECTION_FIRE
Provides protection against fire damage -
PROTECTION_FALL
Provides protection against fall damage -
PROTECTION_EXPLOSIONS
Provides protection against explosive damage -
PROTECTION_PROJECTILE
Provides protection against projectile damage -
OXYGEN
Decreases the rate of air loss whilst underwater -
WATER_WORKER
Increases the speed at which a player may mine underwater -
THORNS
Damages the attacker -
DEPTH_STRIDER
Increases walking speed while in water -
FROST_WALKER
Freezes any still water adjacent to ice / frost which player is walking on -
BINDING_CURSE
Item cannot be removed -
DAMAGE_ALL
Increases damage against all targets -
DAMAGE_UNDEAD
Increases damage against undead targets -
DAMAGE_ARTHROPODS
Increases damage against arthropod targets -
KNOCKBACK
All damage to other targets will knock them back when hit -
FIRE_ASPECT
When attacking a target, has a chance to set them on fire -
LOOT_BONUS_MOBS
Provides a chance of gaining extra loot when killing monsters -
SWEEPING_EDGE
Increases damage against targets when using a sweep attack -
DIG_SPEED
Increases the rate at which you mine/dig -
SILK_TOUCH
Allows blocks to drop themselves instead of fragments (for example, stone instead of cobblestone) -
DURABILITY
Decreases the rate at which a tool looses durability -
LOOT_BONUS_BLOCKS
Provides a chance of gaining extra loot when destroying blocks -
ARROW_DAMAGE
Provides extra damage when shooting arrows from bows -
ARROW_KNOCKBACK
Provides a knockback when an entity is hit by an arrow from a bow -
ARROW_FIRE
Sets entities on fire when hit by arrows shot from a bow -
ARROW_INFINITE
Provides infinite arrows when shooting a bow -
LUCK
Decreases odds of catching worthless junk -
LURE
Increases rate of fish biting your hook -
LOYALTY
Causes a thrown trident to return to the player who threw it -
IMPALING
Deals more damage to mobs that live in the ocean -
RIPTIDE
When it is rainy, launches the player in the direction their trident is thrown -
CHANNELING
Strikes lightning when a mob is hit with a trident if conditions are stormy -
MULTISHOT
Shoot multiple arrows from crossbows -
QUICK_CHARGE
Charges crossbows quickly -
PIERCING
Crossbow projectiles pierce entities -
MENDING
Allows mending the item using experience orbs -
VANISHING_CURSE
Item disappears instead of dropping -
SOUL_SPEED
Walk quicker on soul blocks -
SWIFT_SNEAK
Walk quicker while sneaking
-
-
Constructor Details
-
Enchantment
public Enchantment()
-
-
Method Details
-
getName
Deprecated.enchantments are badly named, useKeyed.getKey().Gets the unique name of this enchantment- Returns:
- Unique name
-
getMaxLevel
public abstract int getMaxLevel()Gets the maximum level that this Enchantment may become.- Returns:
- Maximum level of the Enchantment
-
getStartLevel
public abstract int getStartLevel()Gets the level that this Enchantment should start at- Returns:
- Starting level of the Enchantment
-
getItemTarget
Gets the type ofItemStackthat may fit this Enchantment.- Returns:
- Target type of the Enchantment
-
isTreasure
public 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
-
isCursed
Deprecated.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
-
conflictsWith
Check if this enchantment conflicts with another enchantment.- Parameters:
other- The enchantment to check against- Returns:
- True if there is a conflict.
-
canEnchantItem
Checks 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
-
getByKey
@Contract("null -> null") @Nullable @Deprecated 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 @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
-
values
Deprecated.Gets an array of all the registeredEnchantments- Returns:
- Array of enchantments
-
Registry.get(NamespacedKey)instead