接口 ItemMeta
- 所有超级接口:
Cloneable
,ConfigurationSerializable
- 所有已知子接口:
BannerMeta
,BlockStateMeta
,BookMeta
,EnchantmentStorageMeta
,FireworkEffectMeta
,FireworkMeta
,KnowledgeBookMeta
,LeatherArmorMeta
,MapMeta
,PotionMeta
,SkullMeta
,SpawnEggMeta
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.
-
方法概要
修饰符和类型方法说明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.clone()
Gets the display name that is set.int
getEnchantLevel
(Enchantment ench) Checks for the level of the specified enchantment.Returns a copy the enchantments in this ItemMeta.Get current set itemFlags.Gets the localized display name that is set.getLore()
Gets the lore that is set.boolean
Checks if the specified enchantment conflicts with any enchantments in this ItemMeta.boolean
Checks for existence of a display name.boolean
hasEnchant
(Enchantment ench) Checks for existence of the specified enchantment.boolean
Checks for the existence of any enchantments.boolean
hasItemFlag
(ItemFlag flag) Check if the specified flag is present on this item.boolean
Checks for existence of a localized name.boolean
hasLore()
Checks for existence of lore.boolean
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
(String name) Sets the display name.void
setLocalizedName
(String name) Sets the localized name.void
Sets the lore for this item.void
setUnbreakable
(boolean unbreakable) Sets the unbreakable tag.从接口继承的方法 org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
-
方法详细资料
-
hasDisplayName
boolean hasDisplayName()Checks for existence of a display name.- 返回:
- true if this has a display name
-
getDisplayName
String getDisplayName()Gets the display name that is set.Plugins should check that hasDisplayName() returns
true
before calling this method.- 返回:
- the display name that is set
-
setDisplayName
Sets the display name.- 参数:
name
- the name to set
-
hasLocalizedName
boolean hasLocalizedName()Checks for existence of a localized name.- 返回:
- true if this has a localized name
-
getLocalizedName
String getLocalizedName()Gets the localized display name that is set.Plugins should check that hasLocalizedName() returns
true
before calling this method.- 返回:
- the localized name that is set
-
setLocalizedName
Sets the localized name.- 参数:
name
- the name to set
-
hasLore
boolean hasLore()Checks for existence of lore.- 返回:
- true if this has lore
-
getLore
Gets the lore that is set.Plugins should check if hasLore() returns
true
before calling this method.- 返回:
- a list of lore that is set
-
setLore
Sets the lore for this item. Removes lore when given null.- 参数:
lore
- the lore that will be set
-
hasEnchants
boolean hasEnchants()Checks for the existence of any enchantments.- 返回:
- true if an enchantment exists on this meta
-
hasEnchant
Checks for existence of the specified enchantment.- 参数:
ench
- enchantment to check- 返回:
- true if this enchantment exists for this meta
-
getEnchantLevel
Checks for the level of the specified enchantment.- 参数:
ench
- enchantment to check- 返回:
- The level that the specified enchantment has, or 0 if none
-
getEnchants
Map<Enchantment,Integer> getEnchants()Returns a copy the enchantments in this ItemMeta.
Returns an empty map if none.- 返回:
- An immutable copy of the enchantments
-
addEnchant
Adds the specified enchantment to this item meta.- 参数:
ench
- Enchantment to addlevel
- Level for the enchantmentignoreLevelRestriction
- this indicates the enchantment should be applied, ignoring the level limit- 返回:
- true if the item meta changed as a result of this call, false otherwise
-
removeEnchant
Removes the specified enchantment from this item meta.- 参数:
ench
- Enchantment to remove- 返回:
- true if the item meta changed as a result of this call, false otherwise
-
hasConflictingEnchant
Checks if the specified enchantment conflicts with any enchantments in this ItemMeta.- 参数:
ench
- enchantment to test- 返回:
- true if the enchantment conflicts, false otherwise
-
addItemFlags
Set itemflags which should be ignored when rendering a ItemStack in the Client. This Method does silently ignore double set itemFlags.- 参数:
itemFlags
- The hideflags which shouldn't be rendered
-
removeItemFlags
Remove specific set of itemFlags. This tells the Client it should render it again. This Method does silently ignore double removed itemFlags.- 参数:
itemFlags
- Hideflags which should be removed
-
getItemFlags
Get current set itemFlags. The collection returned is unmodifiable.- 返回:
- A set of all itemFlags set
-
hasItemFlag
Check if the specified flag is present on this item.- 参数:
flag
- the flag to check- 返回:
- if it is present
-
isUnbreakable
boolean isUnbreakable()Return if the unbreakable tag is true. An unbreakable item will not lose durability.- 返回:
- true if the unbreakable tag is true
-
setUnbreakable
void setUnbreakable(boolean unbreakable) Sets the unbreakable tag. An unbreakable item will not lose durability.- 参数:
unbreakable
- true if set unbreakable
-
clone
ItemMeta clone()
-