package org.bukkit.inventory.meta; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; import com.google.common.collect.Multimap; import org.bukkit.attribute.Attribute; import org.bukkit.attribute.AttributeModifier; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemFlag; /** * 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. */ public interface ItemMeta extends Cloneable, ConfigurationSerializable { /** * Checks for existence of a display name. * * @return true if this has a display name */ boolean hasDisplayName(); /** * Gets the display name that is set. *
* Plugins should check that hasDisplayName() returns true
* before calling this method.
*
* @return the display name that is set
*/
String getDisplayName();
/**
* Sets the display name.
*
* @param name the name to set
*/
void setDisplayName(String name);
/**
* Checks for existence of a localized name.
*
* @return true if this has a localized name
*/
boolean hasLocalizedName();
/**
* Gets the localized display name that is set.
*
* Plugins should check that hasLocalizedName() returns true
* before calling this method.
*
* @return the localized name that is set
*/
String getLocalizedName();
/**
* Sets the localized name.
*
* @param name the name to set
*/
void setLocalizedName(String name);
/**
* Checks for existence of lore.
*
* @return true if this has lore
*/
boolean hasLore();
/**
* Gets the lore that is set.
*
* Plugins should check if hasLore() returns true
before
* calling this method.
*
* @return a list of lore that is set
*/
List
* Returns an empty map if none.
*
* @return An immutable copy of the enchantments
*/
Map
* Returns null if none exist.
*
* @return an immutable {@link Multimap} of Attributes
* and their AttributeModifiers, or null if none exist
*/
Multimap
* Any {@link AttributeModifier} that does have have a given
* {@link EquipmentSlot} will be returned. This is because
* AttributeModifiers without a slot are active in any slot.
* If there are no attributes set for the given slot, an empty map
* will be returned.
*
* @param slot the {@link EquipmentSlot} to check
* @return the immutable {@link Multimap} with the
* respective Attributes and modifiers, or an empty map
* if no attributes are set.
*/
Multimap
* Two {@link AttributeModifier}s that have the same {@link java.util.UUID}
* cannot exist on the same Attribute.
*
* @param attribute the {@link Attribute} to modify
* @param modifier the {@link AttributeModifier} specifying the modification
* @return true if the Attribute and AttributeModifier were
* successfully added
* @throws NullPointerException if Attribute is null
* @throws NullPointerException if AttributeModifier is null
* @throws IllegalArgumentException if AttributeModifier already exists
*/
boolean addAttributeModifier(Attribute attribute, AttributeModifier modifier);
/**
* Set all {@link Attribute}s and their {@link AttributeModifier}s.
* To clear all currently set Attributes and AttributeModifiers use
* null or an empty Multimap.
* If not null nor empty, this will filter all entries that are not-null
* and add them to the ItemStack.
*
* @param attributeModifiers the new Multimap containing the Attributes
* and their AttributeModifiers
*/
void setAttributeModifiers(Multimap
* If the given {@link EquipmentSlot} is null, this will remove all
* {@link AttributeModifier}s that do not have an EquipmentSlot set.
*
* @param slot the {@link EquipmentSlot} to clear all Attributes and
* their modifiers for
* @return true if all modifiers were removed that match the given
* EquipmentSlot.
*/
boolean removeAttributeModifier(EquipmentSlot slot);
/**
* Remove a specific {@link Attribute} and {@link AttributeModifier}.
* AttributeModifiers are matched according to their {@link java.util.UUID}.
*
* @param attribute the {@link Attribute} to remove
* @param modifier the {@link AttributeModifier} to remove
* @return if any attribute modifiers were remove
*
* @see AttributeModifier#getUniqueId()
*
* @throws NullPointerException if the Attribute is null
* @throws NullPointerException if the AttributeModifier is null
*/
boolean removeAttributeModifier(Attribute attribute, AttributeModifier modifier);
@SuppressWarnings("javadoc")
ItemMeta clone();
}