public abstract class Enchantment extends Object implements Keyed
Modifier and Type | Field and Description |
---|---|
static Enchantment |
ARROW_DAMAGE
Provides extra damage when shooting arrows from bows
|
static Enchantment |
ARROW_FIRE
Sets entities on fire when hit by arrows shot from a bow
|
static Enchantment |
ARROW_INFINITE
Provides infinite arrows when shooting a bow
|
static Enchantment |
ARROW_KNOCKBACK
Provides a knockback when an entity is hit by an arrow from a bow
|
static Enchantment |
BINDING_CURSE
Item cannot be removed
|
static Enchantment |
CHANNELING
Strikes lightning when a mob is hit with a trident if conditions are
stormy
|
static Enchantment |
DAMAGE_ALL
Increases damage against all targets
|
static Enchantment |
DAMAGE_ARTHROPODS
Increases damage against arthropod targets
|
static Enchantment |
DAMAGE_UNDEAD
Increases damage against undead targets
|
static Enchantment |
DEPTH_STRIDER
Increases walking speed while in water
|
static Enchantment |
DIG_SPEED
Increases the rate at which you mine/dig
|
static Enchantment |
DURABILITY
Decreases the rate at which a tool looses durability
|
static Enchantment |
FIRE_ASPECT
When attacking a target, has a chance to set them on fire
|
static Enchantment |
FROST_WALKER
Freezes any still water adjacent to ice / frost which player is walking on
|
static Enchantment |
IMPALING
Deals more damage to mobs that live in the ocean
|
static Enchantment |
KNOCKBACK
All damage to other targets will knock them back when hit
|
static Enchantment |
LOOT_BONUS_BLOCKS
Provides a chance of gaining extra loot when destroying blocks
|
static Enchantment |
LOOT_BONUS_MOBS
Provides a chance of gaining extra loot when killing monsters
|
static Enchantment |
LOYALTY
Causes a thrown trident to return to the player who threw it
|
static Enchantment |
LUCK
Decreases odds of catching worthless junk
|
static Enchantment |
LURE
Increases rate of fish biting your hook
|
static Enchantment |
MENDING
Allows mending the item using experience orbs
|
static Enchantment |
MULTISHOT
Shoot multiple arrows from crossbows
|
static Enchantment |
OXYGEN
Decreases the rate of air loss whilst underwater
|
static Enchantment |
PIERCING
Crossbow projectiles pierce entities
|
static Enchantment |
PROTECTION_ENVIRONMENTAL
Provides protection against environmental damage
|
static Enchantment |
PROTECTION_EXPLOSIONS
Provides protection against explosive damage
|
static Enchantment |
PROTECTION_FALL
Provides protection against fall damage
|
static Enchantment |
PROTECTION_FIRE
Provides protection against fire damage
|
static Enchantment |
PROTECTION_PROJECTILE
Provides protection against projectile damage
|
static Enchantment |
QUICK_CHARGE
Charges crossbows quickly
|
static Enchantment |
RIPTIDE
When it is rainy, launches the player in the direction their trident is thrown
|
static Enchantment |
SILK_TOUCH
Allows blocks to drop themselves instead of fragments (for example,
stone instead of cobblestone)
|
static Enchantment |
SOUL_SPEED
Walk quicker on soul blocks
|
static Enchantment |
SWEEPING_EDGE
Increases damage against targets when using a sweep attack
|
static Enchantment |
THORNS
Damages the attacker
|
static Enchantment |
VANISHING_CURSE
Item disappears instead of dropping
|
static Enchantment |
WATER_WORKER
Increases the speed at which a player may mine underwater
|
Constructor and Description |
---|
Enchantment(@NotNull NamespacedKey key) |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
canEnchantItem(@NotNull ItemStack item)
Checks if this Enchantment may be applied to the given
ItemStack . |
abstract boolean |
conflictsWith(@NotNull Enchantment other)
Check if this enchantment conflicts with another enchantment.
|
abstract net.kyori.adventure.text.Component |
displayName(int level)
Get the name of the enchantment with its applied level.
|
boolean |
equals(Object obj) |
abstract Set<EquipmentSlot> |
getActiveSlots()
Gets the equipment slots where this enchantment is considered "active".
|
static @Nullable Enchantment |
getByKey(@Nullable NamespacedKey key)
Gets the Enchantment at the specified key
|
static @Nullable Enchantment |
getByName(@Nullable String name)
Deprecated.
enchantments are badly named, use
getByKey(org.bukkit.NamespacedKey) . |
abstract float |
getDamageIncrease(int level,
EntityCategory entityCategory)
Gets the damage increase as a result of the level and entity category specified
|
abstract @NotNull EnchantmentTarget |
getItemTarget()
Gets the type of
ItemStack that may fit this Enchantment. |
@NotNull NamespacedKey |
getKey()
Return the namespaced identifier for this object.
|
abstract int |
getMaxLevel()
Gets the maximum level that this Enchantment may become.
|
abstract @NotNull String |
getName()
Deprecated.
enchantments are badly named, use
getKey() . |
abstract EnchantmentRarity |
getRarity()
Gets the rarity of this enchantment.
|
abstract int |
getStartLevel()
Gets the level that this Enchantment should start at
|
int |
hashCode() |
static boolean |
isAcceptingRegistrations()
Checks if this is accepting Enchantment registrations.
|
abstract boolean |
isCursed()
Deprecated.
cursed enchantments are no longer special. Will return true
only for
BINDING_CURSE and
VANISHING_CURSE . |
abstract boolean |
isDiscoverable()
Checks if this enchantment can be found in an enchanting table
or use to enchant items generated by loot tables.
|
abstract boolean |
isTradeable()
Checks if this enchantment can be found in villager trades.
|
abstract boolean |
isTreasure()
Checks if this enchantment is a treasure enchantment.
|
static void |
registerEnchantment(@NotNull Enchantment enchantment)
Registers an enchantment with the given ID and object.
|
static void |
stopAcceptingRegistrations()
Stops accepting any enchantment registrations
|
String |
toString() |
static @NotNull Enchantment[] |
values()
Gets an array of all the registered
Enchantment s |
public static final Enchantment PROTECTION_ENVIRONMENTAL
public static final Enchantment PROTECTION_FIRE
public static final Enchantment PROTECTION_FALL
public static final Enchantment PROTECTION_EXPLOSIONS
public static final Enchantment PROTECTION_PROJECTILE
public static final Enchantment OXYGEN
public static final Enchantment WATER_WORKER
public static final Enchantment THORNS
public static final Enchantment DEPTH_STRIDER
public static final Enchantment FROST_WALKER
public static final Enchantment BINDING_CURSE
public static final Enchantment DAMAGE_ALL
public static final Enchantment DAMAGE_UNDEAD
public static final Enchantment DAMAGE_ARTHROPODS
public static final Enchantment KNOCKBACK
public static final Enchantment FIRE_ASPECT
public static final Enchantment LOOT_BONUS_MOBS
public static final Enchantment SWEEPING_EDGE
public static final Enchantment DIG_SPEED
public static final Enchantment SILK_TOUCH
public static final Enchantment DURABILITY
public static final Enchantment LOOT_BONUS_BLOCKS
public static final Enchantment ARROW_DAMAGE
public static final Enchantment ARROW_KNOCKBACK
public static final Enchantment ARROW_FIRE
public static final Enchantment ARROW_INFINITE
public static final Enchantment LUCK
public static final Enchantment LURE
public static final Enchantment LOYALTY
public static final Enchantment IMPALING
public static final Enchantment RIPTIDE
public static final Enchantment CHANNELING
public static final Enchantment MULTISHOT
public static final Enchantment QUICK_CHARGE
public static final Enchantment PIERCING
public static final Enchantment MENDING
public static final Enchantment VANISHING_CURSE
public static final Enchantment SOUL_SPEED
public Enchantment(@NotNull @NotNull NamespacedKey key)
@NotNull public @NotNull NamespacedKey getKey()
Keyed
@NotNull @Deprecated public abstract @NotNull String getName()
getKey()
.public abstract int getMaxLevel()
public abstract int getStartLevel()
@NotNull public abstract @NotNull EnchantmentTarget getItemTarget()
ItemStack
that may fit this Enchantment.public abstract boolean isTreasure()
@Deprecated public abstract boolean isCursed()
BINDING_CURSE
and
VANISHING_CURSE
.public abstract boolean conflictsWith(@NotNull @NotNull Enchantment other)
other
- The enchantment to check againstpublic abstract boolean canEnchantItem(@NotNull @NotNull ItemStack item)
ItemStack
.
This does not check if it conflicts with any enchantments already applied to the item.
item
- Item to test@NotNull public abstract net.kyori.adventure.text.Component displayName(int level)
If the given level
is either less than the getStartLevel()
or greater than the getMaxLevel()
,
the level may not be shown in the numeral format one may otherwise expect.
level
- the level of the enchantment to showlevel
appliedpublic abstract boolean isTradeable()
public abstract boolean isDiscoverable()
@NotNull public abstract EnchantmentRarity getRarity()
public abstract float getDamageIncrease(int level, @NotNull EntityCategory entityCategory)
level
- the level of enchantmententityCategory
- the category of entity@NotNull public abstract Set<EquipmentSlot> getActiveSlots()
public static void registerEnchantment(@NotNull @NotNull Enchantment enchantment)
Generally not to be used from within a plugin.
enchantment
- Enchantment to registerpublic static boolean isAcceptingRegistrations()
public static void stopAcceptingRegistrations()
@Contract(value="null -> null") @Nullable public static @Nullable Enchantment getByKey(@Nullable @Nullable NamespacedKey key)
key
- key to fetch@Deprecated @Contract(value="null -> null") @Nullable public static @Nullable Enchantment getByName(@Nullable @Nullable String name)
getByKey(org.bukkit.NamespacedKey)
.name
- Name to fetch@NotNull public static @NotNull Enchantment[] values()
Enchantment
sCopyright © 2021. All rights reserved.