Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
ItemMeta.java
1 package org.bukkit.inventory.meta;
2 
3 import java.util.List;
4 import java.util.Map;
5 
8 
9 /**
10  * This type represents the storage mechanism for auxiliary item data.
11  * <p>
12  * An implementation will handle the creation and application for ItemMeta.
13  * This class should not be implemented by a plugin in a live environment.
14  */
15 public interface ItemMeta extends Cloneable, ConfigurationSerializable {
16 
17  /**
18  * Checks for existence of a display name.
19  *
20  * @return true if this has a display name
21  */
22  boolean hasDisplayName();
23 
24  /**
25  * Gets the display name that is set.
26  * <p>
27  * Plugins should check that hasDisplayName() returns <code>true</code>
28  * before calling this method.
29  *
30  * @return the display name that is set
31  */
32  String getDisplayName();
33 
34  /**
35  * Sets the display name.
36  *
37  * @param name the name to set
38  */
39  void setDisplayName(String name);
40 
41  /**
42  * Checks for existence of lore.
43  *
44  * @return true if this has lore
45  */
46  boolean hasLore();
47 
48  /**
49  * Gets the lore that is set.
50  * <p>
51  * Plugins should check if hasLore() returns <code>true</code> before
52  * calling this method.
53  *
54  * @return a list of lore that is set
55  */
56  List<String> getLore();
57 
58  /**
59  * Sets the lore for this item.
60  * Removes lore when given null.
61  *
62  * @param lore the lore that will be set
63  */
64  void setLore(List<String> lore);
65 
66  /**
67  * Checks for the existence of any enchantments.
68  *
69  * @return true if an enchantment exists on this meta
70  */
71  boolean hasEnchants();
72 
73  /**
74  * Checks for existence of the specified enchantment.
75  *
76  * @param ench enchantment to check
77  * @return true if this enchantment exists for this meta
78  */
79  boolean hasEnchant(Enchantment ench);
80 
81  /**
82  * Checks for the level of the specified enchantment.
83  *
84  * @param ench enchantment to check
85  * @return The level that the specified enchantment has, or 0 if none
86  */
87  int getEnchantLevel(Enchantment ench);
88 
89  /**
90  * Returns a copy the enchantments in this ItemMeta.<br />
91  * Returns an empty map if none.
92  *
93  * @return An immutable copy of the enchantments
94  */
95  Map<Enchantment, Integer> getEnchants();
96 
97  /**
98  * Adds the specified enchantment to this item meta.
99  *
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 }
boolean hasEnchant(Enchantment ench)
int getEnchantLevel(Enchantment ench)
boolean hasConflictingEnchant(Enchantment ench)
void setLore(List< String > lore)
boolean addEnchant(Enchantment ench, int level, boolean ignoreLevelRestriction)
Map< Enchantment, Integer > getEnchants()
boolean removeEnchant(Enchantment ench)