Package org.bukkit.enchantments
Class Enchantment
java.lang.Object
org.bukkit.enchantments.Enchantment
- All Implemented Interfaces:
Keyed
,Translatable
- Direct Known Subclasses:
EnchantmentWrapper
The various type of enchantments that may be added to armour or weapons
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Enchantment
Increases the speed at which a player may mine underwaterstatic final Enchantment
Increases damage against arthropod targetsstatic final Enchantment
Item cannot be removedstatic final Enchantment
Provides protection against explosive damagestatic final Enchantment
Reduces armor effectiveness against macesstatic final Enchantment
Strikes lightning when a mob is hit with a trident if conditions are stormystatic final Enchantment
Increases fall damage of macesstatic final Enchantment
Increases walking speed while in waterstatic final Enchantment
Increases the rate at which you mine/digstatic final Enchantment
Provides protection against fall damagestatic final Enchantment
When attacking a target, has a chance to set them on firestatic final Enchantment
Provides protection against fire damagestatic final Enchantment
Sets entities on fire when hit by arrows shot from a bowstatic final Enchantment
Provides a chance of gaining extra loot when destroying blocksstatic final Enchantment
Freezes any still water adjacent to ice / frost which player is walking onstatic final Enchantment
Deals more damage to mobs that live in the oceanstatic final Enchantment
Provides infinite arrows when shooting a bowstatic final Enchantment
All damage to other targets will knock them back when hitstatic final Enchantment
Provides a chance of gaining extra loot when killing monstersstatic final Enchantment
Causes a thrown trident to return to the player who threw itstatic final Enchantment
Decreases odds of catching worthless junkstatic final Enchantment
Increases rate of fish biting your hookstatic final Enchantment
Allows mending the item using experience orbsstatic final Enchantment
Shoot multiple arrows from crossbowsstatic final Enchantment
Crossbow projectiles pierce entitiesstatic final Enchantment
Provides extra damage when shooting arrows from bowsstatic final Enchantment
Provides protection against projectile damagestatic final Enchantment
Provides protection against environmental damagestatic final Enchantment
Provides a knockback when an entity is hit by an arrow from a bowstatic final Enchantment
Charges crossbows quicklystatic final Enchantment
Decreases the rate of air loss whilst underwaterstatic final Enchantment
When it is rainy, launches the player in the direction their trident is thrownstatic final Enchantment
Increases damage against all targetsstatic final Enchantment
Allows blocks to drop themselves instead of fragments (for example, stone instead of cobblestone)static final Enchantment
Increases damage against undead targetsstatic final Enchantment
Walk quicker on soul blocksstatic final Enchantment
Increases damage against targets when using a sweep attackstatic final Enchantment
Walk quicker while sneakingstatic final Enchantment
Damages the attackerstatic final Enchantment
Decreases the rate at which a tool looses durabilitystatic final Enchantment
Item disappears instead of droppingstatic final Enchantment
Emits wind burst upon hitting enemy -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
canEnchantItem
(ItemStack item) Checks if this Enchantment may be applied to the givenItemStack
.abstract boolean
conflictsWith
(Enchantment other) Check if this enchantment conflicts with another enchantment.static Enchantment
getByKey
(NamespacedKey key) Deprecated.static Enchantment
Deprecated.enchantments are badly named, usegetByKey(org.bukkit.NamespacedKey)
.abstract EnchantmentTarget
Deprecated.enchantment groupings are now managed by tags, not categoriesabstract int
Gets the maximum level that this Enchantment may become.abstract String
getName()
Deprecated.enchantments are badly named, useKeyed.getKey()
.abstract int
Gets the level that this Enchantment should start atabstract boolean
isCursed()
Deprecated.cursed enchantments are no longer special.abstract boolean
Deprecated.enchantment types are now managed by tagsstatic Enchantment[]
values()
Deprecated.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bukkit.Translatable
getTranslationKey
-
Field Details
-
PROTECTION
Provides protection against environmental damage -
FIRE_PROTECTION
Provides protection against fire damage -
FEATHER_FALLING
Provides protection against fall damage -
BLAST_PROTECTION
Provides protection against explosive damage -
PROJECTILE_PROTECTION
Provides protection against projectile damage -
RESPIRATION
Decreases the rate of air loss whilst underwater -
AQUA_AFFINITY
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 -
SHARPNESS
Increases damage against all targets -
SMITE
Increases damage against undead targets -
BANE_OF_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 -
LOOTING
Provides a chance of gaining extra loot when killing monsters -
SWEEPING_EDGE
Increases damage against targets when using a sweep attack -
EFFICIENCY
Increases the rate at which you mine/dig -
SILK_TOUCH
Allows blocks to drop themselves instead of fragments (for example, stone instead of cobblestone) -
UNBREAKING
Decreases the rate at which a tool looses durability -
FORTUNE
Provides a chance of gaining extra loot when destroying blocks -
POWER
Provides extra damage when shooting arrows from bows -
PUNCH
Provides a knockback when an entity is hit by an arrow from a bow -
FLAME
Sets entities on fire when hit by arrows shot from a bow -
INFINITY
Provides infinite arrows when shooting a bow -
LUCK_OF_THE_SEA
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 -
DENSITY
Increases fall damage of maces -
BREACH
Reduces armor effectiveness against maces -
WIND_BURST
Emits wind burst upon hitting enemy -
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
Deprecated.enchantment groupings are now managed by tags, not categoriesGets the type ofItemStack
that may fit this Enchantment.- Returns:
- Target type of the Enchantment
-
isTreasure
Deprecated.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
-
isCursed
Deprecated.cursed enchantments are no longer special. Will return true only forBINDING_CURSE
andVANISHING_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(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
-
values
Deprecated.Gets an array of all the registeredEnchantment
s- Returns:
- Array of enchantments
-
Registry.get(NamespacedKey)
instead