Class Enchantment

java.lang.Object
org.bukkit.enchantments.Enchantment
All Implemented Interfaces:
Keyed, RegistryAware, Translatable
Direct Known Subclasses:
EnchantmentWrapper

public abstract class Enchantment extends Object implements Keyed, Translatable, RegistryAware
The various type of enchantments that may be added to armour or weapons
  • Field Details Link icon

    • PROTECTION Link icon

      public static final Enchantment PROTECTION
      Provides protection against environmental damage
    • FIRE_PROTECTION Link icon

      public static final Enchantment FIRE_PROTECTION
      Provides protection against fire damage
    • FEATHER_FALLING Link icon

      public static final Enchantment FEATHER_FALLING
      Provides protection against fall damage
    • BLAST_PROTECTION Link icon

      public static final Enchantment BLAST_PROTECTION
      Provides protection against explosive damage
    • PROJECTILE_PROTECTION Link icon

      public static final Enchantment PROJECTILE_PROTECTION
      Provides protection against projectile damage
    • RESPIRATION Link icon

      public static final Enchantment RESPIRATION
      Decreases the rate of air loss whilst underwater
    • AQUA_AFFINITY Link icon

      public static final Enchantment AQUA_AFFINITY
      Increases the speed at which a player may mine underwater
    • THORNS Link icon

      public static final Enchantment THORNS
      Damages the attacker
    • DEPTH_STRIDER Link icon

      public static final Enchantment DEPTH_STRIDER
      Increases walking speed while in water
    • FROST_WALKER Link icon

      public static final Enchantment FROST_WALKER
      Freezes any still water adjacent to ice / frost which player is walking on
    • BINDING_CURSE Link icon

      public static final Enchantment BINDING_CURSE
      Item cannot be removed
    • SHARPNESS Link icon

      public static final Enchantment SHARPNESS
      Increases damage against all targets
    • SMITE Link icon

      public static final Enchantment SMITE
      Increases damage against undead targets
    • BANE_OF_ARTHROPODS Link icon

      public static final Enchantment BANE_OF_ARTHROPODS
      Increases damage against arthropod targets
    • KNOCKBACK Link icon

      public static final Enchantment KNOCKBACK
      All damage to other targets will knock them back when hit
    • FIRE_ASPECT Link icon

      public static final Enchantment FIRE_ASPECT
      When attacking a target, has a chance to set them on fire
    • LOOTING Link icon

      public static final Enchantment LOOTING
      Provides a chance of gaining extra loot when killing monsters
    • SWEEPING_EDGE Link icon

      public static final Enchantment SWEEPING_EDGE
      Increases damage against targets when using a sweep attack
    • EFFICIENCY Link icon

      public static final Enchantment EFFICIENCY
      Increases the rate at which you mine/dig
    • SILK_TOUCH Link icon

      public static final Enchantment SILK_TOUCH
      Allows blocks to drop themselves instead of fragments (for example, stone instead of cobblestone)
    • UNBREAKING Link icon

      public static final Enchantment UNBREAKING
      Decreases the rate at which a tool looses durability
    • FORTUNE Link icon

      public static final Enchantment FORTUNE
      Provides a chance of gaining extra loot when destroying blocks
    • POWER Link icon

      public static final Enchantment POWER
      Provides extra damage when shooting arrows from bows
    • PUNCH Link icon

      public static final Enchantment PUNCH
      Provides a knockback when an entity is hit by an arrow from a bow
    • FLAME Link icon

      public static final Enchantment FLAME
      Sets entities on fire when hit by arrows shot from a bow
    • INFINITY Link icon

      public static final Enchantment INFINITY
      Provides infinite arrows when shooting a bow
    • LUCK_OF_THE_SEA Link icon

      public static final Enchantment LUCK_OF_THE_SEA
      Decreases odds of catching worthless junk
    • LURE Link icon

      public static final Enchantment LURE
      Increases rate of fish biting your hook
    • LOYALTY Link icon

      public static final Enchantment LOYALTY
      Causes a thrown trident to return to the player who threw it
    • IMPALING Link icon

      public static final Enchantment IMPALING
      Deals more damage to mobs that live in the ocean
    • RIPTIDE Link icon

      public static final Enchantment RIPTIDE
      When it is rainy, launches the player in the direction their trident is thrown
    • CHANNELING Link icon

      public static final Enchantment CHANNELING
      Strikes lightning when a mob is hit with a trident if conditions are stormy
    • MULTISHOT Link icon

      public static final Enchantment MULTISHOT
      Shoot multiple arrows from crossbows
    • QUICK_CHARGE Link icon

      public static final Enchantment QUICK_CHARGE
      Charges crossbows quickly
    • PIERCING Link icon

      public static final Enchantment PIERCING
      Crossbow projectiles pierce entities
    • DENSITY Link icon

      public static final Enchantment DENSITY
      Increases fall damage of maces
    • BREACH Link icon

      public static final Enchantment BREACH
      Reduces armor effectiveness against maces
    • WIND_BURST Link icon

      public static final Enchantment WIND_BURST
      Emits wind burst upon hitting enemy
    • MENDING Link icon

      public static final Enchantment MENDING
      Allows mending the item using experience orbs
    • VANISHING_CURSE Link icon

      public static final Enchantment VANISHING_CURSE
      Item disappears instead of dropping
    • SOUL_SPEED Link icon

      public static final Enchantment SOUL_SPEED
      Walk quicker on soul blocks
    • SWIFT_SNEAK Link icon

      public static final Enchantment SWIFT_SNEAK
      Walk quicker while sneaking
  • Constructor Details Link icon

    • Enchantment Link icon

      public Enchantment()
  • Method Details Link icon

    • getName Link icon

      @NotNull @Deprecated(since="1.13") public abstract String getName()
      Deprecated.
      enchantments are badly named, use getKey().
      Gets the unique name of this enchantment
      Returns:
      Unique name
    • getMaxLevel Link icon

      public abstract int getMaxLevel()
      Gets the maximum level that this Enchantment may become.
      Returns:
      Maximum level of the Enchantment
    • getStartLevel Link icon

      public abstract int getStartLevel()
      Gets the level that this Enchantment should start at
      Returns:
      Starting level of the Enchantment
    • getItemTarget Link icon

      @NotNull @Deprecated(since="1.20.5") public abstract EnchantmentTarget getItemTarget()
      Deprecated.
      enchantment groupings are now managed by tags, not categories
      Gets the type of ItemStack that may fit this Enchantment.
      Returns:
      Target type of the Enchantment
    • isTreasure Link icon

      @Deprecated(since="1.21") public abstract boolean isTreasure()
      Deprecated.
      enchantment types are now managed by tags
      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 Link icon

      @Deprecated(since="1.13") public abstract boolean isCursed()
      Deprecated.
      cursed enchantments are no longer special. Will return true only for BINDING_CURSE and VANISHING_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 Link icon

      public abstract boolean conflictsWith(@NotNull Enchantment other)
      Check if this enchantment conflicts with another enchantment.
      Parameters:
      other - The enchantment to check against
      Returns:
      True if there is a conflict.
    • canEnchantItem Link icon

      public abstract boolean canEnchantItem(@NotNull ItemStack item)
      Checks if this Enchantment may be applied to the given ItemStack.

      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
    • getKey Link icon

      @NotNull @Deprecated(since="1.21.4") public abstract NamespacedKey getKey()
      Deprecated.
      A key might not always be present, use RegistryAware.getKeyOrThrow() instead.
      Return the namespaced identifier for this object.
      Specified by:
      getKey in interface Keyed
      Returns:
      this object's key
      See Also:
    • getByKey Link icon

      @Contract("null -> null") @Nullable @Deprecated(since="1.20.3") public static Enchantment getByKey(@Nullable NamespacedKey key)
      Deprecated.
      only for backwards compatibility, use Registry.get(NamespacedKey) instead
      Gets the Enchantment at the specified key
      Parameters:
      key - key to fetch
      Returns:
      Resulting Enchantment, or null if not found
    • getByName Link icon

      @Deprecated(since="1.13") @Contract("null -> null") @Nullable public static Enchantment getByName(@Nullable String name)
      Deprecated.
      enchantments are badly named, use getByKey(org.bukkit.NamespacedKey).
      Gets the Enchantment at the specified name
      Parameters:
      name - Name to fetch
      Returns:
      Resulting Enchantment, or null if not found
    • values Link icon

      @NotNull @Deprecated(since="1.20.3") public static Enchantment[] values()
      Gets an array of all the registered Enchantments
      Returns:
      Array of enchantments