public interface ItemMeta extends java.lang.Cloneable, ConfigurationSerializable
An implementation will handle the creation and application for ItemMeta. This class should not be implemented by a plugin in a live environment.
限定符和类型 | 方法和说明 |
---|---|
boolean |
addEnchant(Enchantment ench,
int level,
boolean ignoreLevelRestriction)
Adds the specified enchantment to this item meta.
|
void |
addItemFlags(ItemFlag... itemFlags)
Set itemflags which should be ignored when rendering a ItemStack in the Client.
|
ItemMeta |
clone() |
java.lang.String |
getDisplayName()
Gets the display name that is set.
|
int |
getEnchantLevel(Enchantment ench)
Checks for the level of the specified enchantment.
|
java.util.Map<Enchantment,java.lang.Integer> |
getEnchants()
Returns a copy the enchantments in this ItemMeta.
|
java.util.Set<ItemFlag> |
getItemFlags()
Get current set itemFlags.
|
java.lang.String |
getLocalizedName()
Gets the localized display name that is set.
|
java.util.List<java.lang.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 |
hasItemFlag(ItemFlag flag)
Check if the specified flag is present on this item.
|
boolean |
hasLocalizedName()
Checks for existence of a localized name.
|
boolean |
hasLore()
Checks for existence of lore.
|
boolean |
isUnbreakable()
Return if the unbreakable tag is true.
|
boolean |
removeEnchant(Enchantment ench)
Removes the specified enchantment from this item meta.
|
void |
removeItemFlags(ItemFlag... itemFlags)
Remove specific set of itemFlags.
|
void |
setDisplayName(java.lang.String name)
Sets the display name.
|
void |
setLocalizedName(java.lang.String name)
Sets the localized name.
|
void |
setLore(java.util.List<java.lang.String> lore)
Sets the lore for this item.
|
void |
setUnbreakable(boolean unbreakable)
Sets the unbreakable tag.
|
serialize
boolean hasDisplayName()
java.lang.String getDisplayName()
Plugins should check that hasDisplayName() returns true
before calling this method.
void setDisplayName(java.lang.String name)
name
- the name to setboolean hasLocalizedName()
java.lang.String getLocalizedName()
Plugins should check that hasLocalizedName() returns true
before calling this method.
void setLocalizedName(java.lang.String name)
name
- the name to setboolean hasLore()
java.util.List<java.lang.String> getLore()
Plugins should check if hasLore() returns true
before
calling this method.
void setLore(java.util.List<java.lang.String> lore)
lore
- the lore that will be setboolean hasEnchants()
boolean hasEnchant(Enchantment ench)
ench
- enchantment to checkint getEnchantLevel(Enchantment ench)
ench
- enchantment to checkjava.util.Map<Enchantment,java.lang.Integer> getEnchants()
boolean addEnchant(Enchantment ench, int level, boolean ignoreLevelRestriction)
ench
- Enchantment to addlevel
- Level for the enchantmentignoreLevelRestriction
- this indicates the enchantment should be
applied, ignoring the level limitboolean removeEnchant(Enchantment ench)
ench
- Enchantment to removeboolean hasConflictingEnchant(Enchantment ench)
ench
- enchantment to testvoid addItemFlags(ItemFlag... itemFlags)
itemFlags
- The hideflags which shouldn't be renderedvoid removeItemFlags(ItemFlag... itemFlags)
itemFlags
- Hideflags which should be removedjava.util.Set<ItemFlag> getItemFlags()
boolean hasItemFlag(ItemFlag flag)
flag
- the flag to checkboolean isUnbreakable()
void setUnbreakable(boolean unbreakable)
unbreakable
- true if set unbreakableItemMeta clone()