Package org.bukkit.inventory.meta
Interface EnchantmentStorageMeta
- All Superinterfaces:
Cloneable
,ConfigurationSerializable
,ItemMeta
,PersistentDataHolder
,PersistentDataViewHolder
EnchantmentMeta is specific to items that can store enchantments, as
opposed to being enchanted.
Material.ENCHANTED_BOOK
is an example
of an item with enchantment storage.-
Method Summary
Modifier and TypeMethodDescriptionboolean
addStoredEnchant
(@NotNull Enchantment ench, int level, boolean ignoreLevelRestriction) Stores the specified enchantment in this item meta.clone()
int
Checks for the level of the stored enchantment.Gets a copy the stored enchantments in this ItemMeta.boolean
Checks if the specified enchantment conflicts with any enchantments in this ItemMeta.boolean
Checks for storage of the specified enchantment.boolean
Checks for the existence of any stored enchantments.boolean
Remove the specified stored enchantment from this item meta.Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
Methods inherited from interface org.bukkit.inventory.meta.ItemMeta
addAttributeModifier, addEnchant, addItemFlags, customName, customName, displayName, displayName, getAsComponentString, getAsString, getAttributeModifiers, getAttributeModifiers, getAttributeModifiers, getCanDestroy, getCanPlaceOn, getCustomModelData, getCustomModelDataComponent, getCustomTagContainer, getDamageResistant, getDestroyableKeys, getDisplayName, getDisplayNameComponent, getEnchantable, getEnchantLevel, getEnchantmentGlintOverride, getEnchants, getEquippable, getFood, getItemFlags, getItemModel, getItemName, getJukeboxPlayable, getLocalizedName, getLore, getLoreComponents, getMaxStackSize, getPlaceableKeys, getRarity, getTool, getTooltipStyle, getUseCooldown, getUseRemainder, hasAttributeModifiers, hasConflictingEnchant, hasCustomModelData, hasCustomName, hasDamageResistant, hasDestroyableKeys, hasDisplayName, hasEnchant, hasEnchantable, hasEnchantmentGlintOverride, hasEnchants, hasEquippable, hasFood, hasItemFlag, hasItemModel, hasItemName, hasJukeboxPlayable, hasLocalizedName, hasLore, hasMaxStackSize, hasPlaceableKeys, hasRarity, hasTool, hasTooltipStyle, hasUseCooldown, hasUseRemainder, isFireResistant, isGlider, isHideTooltip, isUnbreakable, itemName, itemName, lore, lore, removeAttributeModifier, removeAttributeModifier, removeAttributeModifier, removeEnchant, removeEnchantments, removeItemFlags, setAttributeModifiers, setCanDestroy, setCanPlaceOn, setCustomModelData, setCustomModelDataComponent, setDamageResistant, setDestroyableKeys, setDisplayName, setDisplayNameComponent, setEnchantable, setEnchantmentGlintOverride, setEquippable, setFireResistant, setFood, setGlider, setHideTooltip, setItemModel, setItemName, setJukeboxPlayable, setLocalizedName, setLore, setLoreComponents, setMaxStackSize, setPlaceableKeys, setRarity, setTool, setTooltipStyle, setUnbreakable, setUseCooldown, setUseRemainder, setVersion
Methods inherited from interface org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
-
Method Details
-
hasStoredEnchants
boolean hasStoredEnchants()Checks for the existence of any stored enchantments.- Returns:
- true if an enchantment exists on this meta
-
hasStoredEnchant
Checks for storage of the specified enchantment.- Parameters:
ench
- enchantment to check- Returns:
- true if this enchantment is stored in this meta
-
getStoredEnchantLevel
Checks for the level of the stored enchantment.- Parameters:
ench
- enchantment to check- Returns:
- The level that the specified stored enchantment has, or 0 if none
-
getStoredEnchants
Gets a copy the stored enchantments in this ItemMeta.- Returns:
- An immutable copy of the stored enchantments
-
addStoredEnchant
boolean addStoredEnchant(@NotNull @NotNull Enchantment ench, int level, boolean ignoreLevelRestriction) Stores the specified enchantment in this item meta.- Parameters:
ench
- Enchantment to storelevel
- Level for the enchantmentignoreLevelRestriction
- this indicates the enchantment should be applied, ignoring the level limit- Returns:
- true if the item meta changed as a result of this call, false otherwise
- Throws:
IllegalArgumentException
- if enchantment is null
-
removeStoredEnchant
Remove the specified stored enchantment from this item meta.- Parameters:
ench
- Enchantment to remove- Returns:
- true if the item meta changed as a result of this call, false otherwise
- Throws:
IllegalArgumentException
- if enchantment is null
-
hasConflictingStoredEnchant
Checks if the specified enchantment conflicts with any enchantments in this ItemMeta.- Parameters:
ench
- enchantment to test- Returns:
- true if the enchantment conflicts, false otherwise
-
clone
-