Package org.bukkit.enchantments
Class EnchantmentWrapper
java.lang.Object
org.bukkit.enchantments.Enchantment
org.bukkit.enchantments.EnchantmentWrapper
- All Implemented Interfaces:
Translatable
,Keyed
A simple wrapper for ease of selecting
Enchantment
s-
Field Summary
Fields inherited from class org.bukkit.enchantments.Enchantment
ARROW_DAMAGE, ARROW_FIRE, ARROW_INFINITE, ARROW_KNOCKBACK, BINDING_CURSE, CHANNELING, DAMAGE_ALL, DAMAGE_ARTHROPODS, DAMAGE_UNDEAD, DEPTH_STRIDER, DIG_SPEED, DURABILITY, FIRE_ASPECT, FROST_WALKER, IMPALING, KNOCKBACK, LOOT_BONUS_BLOCKS, LOOT_BONUS_MOBS, LOYALTY, LUCK, LURE, MENDING, MULTISHOT, OXYGEN, PIERCING, PROTECTION_ENVIRONMENTAL, PROTECTION_EXPLOSIONS, PROTECTION_FALL, PROTECTION_FIRE, PROTECTION_PROJECTILE, QUICK_CHARGE, RIPTIDE, SILK_TOUCH, SOUL_SPEED, SWEEPING_EDGE, THORNS, VANISHING_CURSE, WATER_WORKER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canEnchantItem(@NotNull ItemStack item)
Checks if this Enchantment may be applied to the givenItemStack
.boolean
conflictsWith(@NotNull Enchantment other)
Check if this enchantment conflicts with another enchantment.displayName(int level)
Get the name of the enchantment with its applied level.Gets the equipment slots where this enchantment is considered "active".float
getDamageIncrease(int level, EntityCategory entityCategory)
Gets the damage increase as a result of the level and entity category specifiedGets the enchantment bound to this wrapperGets the type ofItemStack
that may fit this Enchantment.int
Gets the maximum level that this Enchantment may become.getName()
Gets the unique name of this enchantmentGets the rarity of this enchantment.int
Gets the level that this Enchantment should start atboolean
isCursed()
Checks if this enchantment is a cursed enchantment
Cursed enchantments are found the same way treasure enchantments areboolean
Checks if this enchantment can be found in an enchanting table or use to enchant items generated by loot tables.boolean
Checks if this enchantment can be found in villager trades.boolean
Checks if this enchantment is a treasure enchantment.Gets the translation key.Methods inherited from class org.bukkit.enchantments.Enchantment
equals, getByKey, getByName, getKey, hashCode, isAcceptingRegistrations, registerEnchantment, stopAcceptingRegistrations, toString, values
-
Constructor Details
-
EnchantmentWrapper
-
-
Method Details
-
getEnchantment
Gets the enchantment bound to this wrapper- Returns:
- Enchantment
-
getMaxLevel
public int getMaxLevel()Description copied from class:Enchantment
Gets the maximum level that this Enchantment may become.- Specified by:
getMaxLevel
in classEnchantment
- Returns:
- Maximum level of the Enchantment
-
getStartLevel
public int getStartLevel()Description copied from class:Enchantment
Gets the level that this Enchantment should start at- Specified by:
getStartLevel
in classEnchantment
- Returns:
- Starting level of the Enchantment
-
getItemTarget
Description copied from class:Enchantment
Gets the type ofItemStack
that may fit this Enchantment.- Specified by:
getItemTarget
in classEnchantment
- Returns:
- Target type of the Enchantment
-
canEnchantItem
Description copied from class:Enchantment
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.
- Specified by:
canEnchantItem
in classEnchantment
- Parameters:
item
- Item to test- Returns:
- True if the enchantment may be applied, otherwise False
-
getName
Description copied from class:Enchantment
Gets the unique name of this enchantment- Specified by:
getName
in classEnchantment
- Returns:
- Unique name
-
isTreasure
public boolean isTreasure()Description copied from class:Enchantment
Checks if this enchantment is a treasure enchantment.
Treasure enchantments can only be received via looting, trading, or fishing.- Specified by:
isTreasure
in classEnchantment
- Returns:
- true if the enchantment is a treasure enchantment
-
isCursed
public boolean isCursed()Description copied from class:Enchantment
Checks if this enchantment is a cursed enchantment
Cursed enchantments are found the same way treasure enchantments are- Specified by:
isCursed
in classEnchantment
- Returns:
- true if the enchantment is cursed
-
conflictsWith
Description copied from class:Enchantment
Check if this enchantment conflicts with another enchantment.- Specified by:
conflictsWith
in classEnchantment
- Parameters:
other
- The enchantment to check against- Returns:
- True if there is a conflict.
-
displayName
Description copied from class:Enchantment
Get the name of the enchantment with its applied level.If the given
level
is either less than theEnchantment.getStartLevel()
or greater than theEnchantment.getMaxLevel()
, the level may not be shown in the numeral format one may otherwise expect.- Specified by:
displayName
in classEnchantment
- Parameters:
level
- the level of the enchantment to show- Returns:
- the name of the enchantment with
level
applied
-
translationKey
Description copied from interface:net.kyori.adventure.translation.Translatable
Gets the translation key.- Returns:
- the translation key
-
isTradeable
public boolean isTradeable()Description copied from class:Enchantment
Checks if this enchantment can be found in villager trades.- Specified by:
isTradeable
in classEnchantment
- Returns:
- true if the enchantment can be found in trades
-
isDiscoverable
public boolean isDiscoverable()Description copied from class:Enchantment
Checks if this enchantment can be found in an enchanting table or use to enchant items generated by loot tables.- Specified by:
isDiscoverable
in classEnchantment
- Returns:
- true if the enchantment can be found in a table or by loot tables
-
getRarity
Description copied from class:Enchantment
Gets the rarity of this enchantment.- Specified by:
getRarity
in classEnchantment
- Returns:
- the rarity
-
getDamageIncrease
Description copied from class:Enchantment
Gets the damage increase as a result of the level and entity category specified- Specified by:
getDamageIncrease
in classEnchantment
- Parameters:
level
- the level of enchantmententityCategory
- the category of entity- Returns:
- the damage increase
-
getActiveSlots
Description copied from class:Enchantment
Gets the equipment slots where this enchantment is considered "active".- Specified by:
getActiveSlots
in classEnchantment
- Returns:
- the equipment slots
-