001    package org.bukkit.inventory.meta;
002    
003    import java.util.List;
004    import java.util.Map;
005    
006    import org.bukkit.configuration.serialization.ConfigurationSerializable;
007    import org.bukkit.enchantments.Enchantment;
008    
009    /**
010     * This type represents the storage mechanism for auxiliary item data.
011     * <p>
012     * An implementation will handle the creation and application for ItemMeta.
013     * This class should not be implemented by a plugin in a live environment.
014     */
015    public interface ItemMeta extends Cloneable, ConfigurationSerializable {
016    
017        /**
018         * Checks for existence of a display name.
019         *
020         * @return true if this has a display name
021         */
022        boolean hasDisplayName();
023    
024        /**
025         * Gets the display name that is set.
026         * <p>
027         * Plugins should check that hasDisplayName() returns <code>true</code>
028         * before calling this method.
029         *
030         * @return the display name that is set
031         */
032        String getDisplayName();
033    
034        /**
035         * Sets the display name.
036         *
037         * @param name the name to set
038         */
039        void setDisplayName(String name);
040    
041        /**
042         * Checks for existence of lore.
043         *
044         * @return true if this has lore
045         */
046        boolean hasLore();
047    
048        /**
049         * Gets the lore that is set.
050         * <p>
051         * Plugins should check if hasLore() returns <code>true</code> before
052         * calling this method.
053         * 
054         * @return a list of lore that is set
055         */
056        List<String> getLore();
057    
058        /**
059         * Sets the lore for this item. 
060         * Removes lore when given null.
061         *
062         * @param lore the lore that will be set
063         */
064        void setLore(List<String> lore);
065    
066        /**
067         * Checks for the existence of any enchantments.
068         *
069         * @return true if an enchantment exists on this meta
070         */
071        boolean hasEnchants();
072    
073        /**
074         * Checks for existence of the specified enchantment.
075         *
076         * @param ench enchantment to check
077         * @return true if this enchantment exists for this meta
078         */
079        boolean hasEnchant(Enchantment ench);
080    
081        /**
082         * Checks for the level of the specified enchantment.
083         *
084         * @param ench enchantment to check
085         * @return The level that the specified enchantment has, or 0 if none
086         */
087        int getEnchantLevel(Enchantment ench);
088    
089        /**
090         * Returns a copy the enchantments in this ItemMeta.<br />
091         * Returns an empty map if none.
092         *
093         * @return An immutable copy of the enchantments
094         */
095        Map<Enchantment, Integer> getEnchants();
096    
097        /**
098         * Adds the specified enchantment to this item meta.
099         *
100         * @param ench Enchantment to add
101         * @param level Level for the enchantment
102         * @param ignoreLevelRestriction this indicates the enchantment should be
103         *     applied, ignoring the level limit
104         * @return true if the item meta changed as a result of this call, false
105         *     otherwise
106         */
107        boolean addEnchant(Enchantment ench, int level, boolean ignoreLevelRestriction);
108    
109        /**
110         * Removes the specified enchantment from this item meta.
111         *
112         * @param ench Enchantment to remove
113         * @return true if the item meta changed as a result of this call, false
114         *     otherwise
115         */
116        boolean removeEnchant(Enchantment ench);
117    
118       /**
119        * Checks if the specified enchantment conflicts with any enchantments in
120        * this ItemMeta.
121        *
122        * @param ench enchantment to test
123        * @return true if the enchantment conflicts, false otherwise
124        */
125        boolean hasConflictingEnchant(Enchantment ench);
126    
127        @SuppressWarnings("javadoc")
128        ItemMeta clone();
129    }