public interface ItemMeta extends 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.
Modifier and Type | Interface and Description |
---|---|
static class |
ItemMeta.Spigot |
Modifier and Type | Method and Description |
---|---|
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() |
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.
|
Set<ItemFlag> |
getItemFlags()
Get current set itemFlags.
|
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 |
hasItemFlag(ItemFlag flag)
Check if the specified flag is present on this item.
|
boolean |
hasLore()
Checks for existence of lore.
|
boolean |
removeEnchant(Enchantment ench)
Removes the specified enchantment from this item meta.
|
void |
removeItemFlags(ItemFlag... itemFlags)
Remove specific set of itemFlags.
|
void |
setDisplayName(String name)
Sets the display name.
|
void |
setLore(List<String> lore)
Sets the lore for this item.
|
ItemMeta.Spigot |
spigot() |
serialize
boolean hasDisplayName()
String getDisplayName()
Plugins should check that hasDisplayName() returns true
before calling this method.
void setDisplayName(String name)
name
- the name to setboolean hasLore()
List<String> getLore()
Plugins should check if hasLore() returns true
before
calling this method.
void setLore(List<String> lore)
lore
- the lore that will be setboolean hasEnchants()
boolean hasEnchant(Enchantment ench)
ench
- enchantment to checkint getEnchantLevel(Enchantment ench)
ench
- enchantment to checkMap<Enchantment,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 removedSet<ItemFlag> getItemFlags()
boolean hasItemFlag(ItemFlag flag)
flag
- the flag to checkItemMeta clone()
ItemMeta.Spigot spigot()
Copyright © 2022. All rights reserved.