org.bukkit.inventory.meta
Interface ItemMeta

All Superinterfaces:
Cloneable, ConfigurationSerializable
All Known Subinterfaces:
BookMeta, EnchantmentStorageMeta, FireworkEffectMeta, FireworkMeta, LeatherArmorMeta, MapMeta, PotionMeta, SkullMeta

public interface ItemMeta
extends Cloneable, ConfigurationSerializable

This type represents the storage mechanism for auxiliary item data. An implementation will handle the creation and application for ItemMeta. This class should not be implemented by a plugin in a live environment.


Method Summary
 boolean addEnchant(Enchantment ench, int level, boolean ignoreLevelRestriction)
          Adds the specified enchantment to this item meta.
 ItemMeta clone()
           
 String getDisplayName()
          Gets the display name that is set.
 int getEnchantLevel(Enchantment ench)
          Checks for the level of the specified enchantment.
 Map<Enchantment,Integer> getEnchants()
          Returns a copy the enchantments in this ItemMeta.
Returns an empty map if none.
 List<String> getLore()
          Gets the lore that is set.
 boolean hasConflictingEnchant(Enchantment ench)
          Checks if the specified enchantment conflicts with any enchantments in this ItemMeta.
 boolean hasDisplayName()
          Checks for existence of a display name.
 boolean hasEnchant(Enchantment ench)
          Checks for existence of the specified enchantment.
 boolean hasEnchants()
          Checks for the existence of any enchantments.
 boolean hasLore()
          Checks for existence of lore.
 boolean removeEnchant(Enchantment ench)
          Removes the specified enchantment from this item meta.
 void setDisplayName(String name)
          Sets the display name.
 void setLore(List<String> lore)
          Sets the lore for this item.
 
Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
 

Method Detail

hasDisplayName

boolean hasDisplayName()
Checks for existence of a display name.

Returns:
true if this has a display name

getDisplayName

String getDisplayName()
Gets the display name that is set. Plugins should check that hasDisplayName() returns true before calling this method.

Returns:
the display name that is set

setDisplayName

void setDisplayName(String name)
Sets the display name.

Parameters:
name - the name to set

hasLore

boolean hasLore()
Checks for existence of lore.

Returns:
true if this has lore

getLore

List<String> getLore()
Gets the lore that is set. Plugins should check if hasLore() returns true before calling this method.

Returns:
a list of lore that is set

setLore

void setLore(List<String> lore)
Sets the lore for this item. Removes lore when given null.

Parameters:
lore - the lore that will be set

hasEnchants

boolean hasEnchants()
Checks for the existence of any enchantments.

Returns:
true if an enchantment exists on this meta

hasEnchant

boolean hasEnchant(Enchantment ench)
Checks for existence of the specified enchantment.

Parameters:
ench - enchantment to check
Returns:
true if this enchantment exists for this meta

getEnchantLevel

int getEnchantLevel(Enchantment ench)
Checks for the level of the specified enchantment.

Parameters:
ench - enchantment to check
Returns:
The level that the specified enchantment has, or 0 if none

getEnchants

Map<Enchantment,Integer> getEnchants()
Returns a copy the enchantments in this ItemMeta.
Returns an empty map if none.

Returns:
An immutable copy of the enchantments

addEnchant

boolean addEnchant(Enchantment ench,
                   int level,
                   boolean ignoreLevelRestriction)
Adds the specified enchantment to this item meta.

Parameters:
ench - Enchantment to add
level - Level for the enchantment
ignoreLevelRestriction - 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

removeEnchant

boolean removeEnchant(Enchantment ench)
Removes the specified 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

hasConflictingEnchant

boolean hasConflictingEnchant(Enchantment ench)
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

ItemMeta clone()


Copyright © 2013. All Rights Reserved.