Package org.bukkit.inventory.meta
Interface EnchantmentStorageMeta
- All Superinterfaces:
java.lang.Cloneable,ConfigurationSerializable,ItemMeta
public interface EnchantmentStorageMeta extends ItemMeta
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.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.bukkit.inventory.meta.ItemMeta
ItemMeta.Spigot -
Method Summary
Modifier and Type Method Description booleanaddStoredEnchant(Enchantment ench, int level, boolean ignoreLevelRestriction)Stores the specified enchantment in this item meta.EnchantmentStorageMetaclone()intgetStoredEnchantLevel(Enchantment ench)Checks for the level of the stored enchantment.java.util.Map<Enchantment,java.lang.Integer>getStoredEnchants()Gets a copy the stored enchantments in this ItemMeta.booleanhasConflictingStoredEnchant(Enchantment ench)Checks if the specified enchantment conflicts with any enchantments in this ItemMeta.booleanhasStoredEnchant(Enchantment ench)Checks for storage of the specified enchantment.booleanhasStoredEnchants()Checks for the existence of any stored enchantments.booleanremoveStoredEnchant(Enchantment ench)Remove the specified stored enchantment from this item meta.Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serializeMethods inherited from interface org.bukkit.inventory.meta.ItemMeta
addEnchant, addItemFlags, getDisplayName, getEnchantLevel, getEnchants, getItemFlags, getLore, hasConflictingEnchant, hasDisplayName, hasEnchant, hasEnchants, hasItemFlag, hasLore, removeEnchant, removeItemFlags, setDisplayName, setLore, spigot
-
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
java.util.Map<Enchantment,java.lang.Integer> getStoredEnchants()Gets a copy the stored enchantments in this ItemMeta.- Returns:
- An immutable copy of the stored enchantments
-
addStoredEnchant
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:
java.lang.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:
java.lang.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
EnchantmentStorageMeta clone()
-