Cloneable, ConfigurationSerializable, PersistentDataHolderBannerMeta, BlockDataMeta, BlockStateMeta, BookMeta, CrossbowMeta, EnchantmentStorageMeta, FireworkEffectMeta, FireworkMeta, KnowledgeBookMeta, LeatherArmorMeta, MapMeta, PotionMeta, SkullMeta, SpawnEggMeta, SuspiciousStewMeta, TropicalFishBucketMetapublic interface ItemMeta extends Cloneable, ConfigurationSerializable, PersistentDataHolder
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 | Method | Description | 
|---|---|---|
| boolean | addAttributeModifier(@NotNull Attribute attribute,
                    @NotNull AttributeModifier modifier) | Add an Attribute and it's Modifier. | 
| boolean | addEnchant(@NotNull Enchantment ench,
          int level,
          boolean ignoreLevelRestriction) | Adds the specified enchantment to this item meta. | 
| void | addItemFlags(@NotNull ItemFlag... itemFlags) | Set itemflags which should be ignored when rendering a ItemStack in the Client. | 
| @NotNull ItemMeta | clone() | |
| @Nullable com.google.common.collect.Multimap<Attribute,AttributeModifier> | getAttributeModifiers() | Return an immutable copy of all Attributes and
 their modifiers in this ItemMeta. Returns null if none exist. | 
| @Nullable Collection<AttributeModifier> | getAttributeModifiers(@NotNull Attribute attribute) | Return an immutable copy of all  AttributeModifiers
 for a givenAttribute | 
| @NotNull com.google.common.collect.Multimap<Attribute,AttributeModifier> | getAttributeModifiers(@NotNull EquipmentSlot slot) | Return an immutable copy of all  Attributes and theirAttributeModifiers for a givenEquipmentSlot.Any AttributeModifierthat does have have a givenEquipmentSlotwill be returned. | 
| int | getCustomModelData() | Gets the custom model data that is set. | 
| @NotNull CustomItemTagContainer | getCustomTagContainer() | Deprecated. 
 this API part has been replaced by the  PersistentDataHolderAPI.
 Please usePersistentDataHolder.getPersistentDataContainer()instead of this. | 
| @NotNull String | getDisplayName() | Gets the display name that is set. | 
| int | getEnchantLevel(@NotNull Enchantment ench) | Checks for the level of the specified enchantment. | 
| @NotNull Map<Enchantment,Integer> | getEnchants() | Returns a copy the enchantments in this ItemMeta. | 
| @NotNull Set<ItemFlag> | getItemFlags() | Get current set itemFlags. | 
| @NotNull String | getLocalizedName() | Gets the localized display name that is set. | 
| @Nullable List<String> | getLore() | Gets the lore that is set. | 
| boolean | hasAttributeModifiers() | Checks for the existence of any AttributeModifiers. | 
| boolean | hasConflictingEnchant(@NotNull Enchantment ench) | Checks if the specified enchantment conflicts with any enchantments in
 this ItemMeta. | 
| boolean | hasCustomModelData() | Checks for existence of custom model data. | 
| boolean | hasDisplayName() | Checks for existence of a display name. | 
| boolean | hasEnchant(@NotNull Enchantment ench) | Checks for existence of the specified enchantment. | 
| boolean | hasEnchants() | Checks for the existence of any enchantments. | 
| boolean | hasItemFlag(@NotNull 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 | removeAttributeModifier(@NotNull Attribute attribute) | Remove all  AttributeModifiers associated with the givenAttribute. | 
| boolean | removeAttributeModifier(@NotNull Attribute attribute,
                       @NotNull AttributeModifier modifier) | Remove a specific  AttributeandAttributeModifier. | 
| boolean | removeAttributeModifier(@NotNull EquipmentSlot slot) | Remove all  Attributes andAttributeModifiers for a
 givenEquipmentSlot.If the given EquipmentSlotis null, this will remove allAttributeModifiers that do not have an EquipmentSlot set. | 
| boolean | removeEnchant(@NotNull Enchantment ench) | Removes the specified enchantment from this item meta. | 
| void | removeItemFlags(@NotNull ItemFlag... itemFlags) | Remove specific set of itemFlags. | 
| void | setAttributeModifiers(@Nullable com.google.common.collect.Multimap<Attribute,AttributeModifier> attributeModifiers) | Set all  Attributes and theirAttributeModifiers. | 
| void | setCustomModelData(@Nullable Integer data) | Sets the custom model data. | 
| void | setDisplayName(@Nullable String name) | Sets the display name. | 
| void | setLocalizedName(@Nullable String name) | Sets the localized name. | 
| void | setLore(@Nullable List<String> lore) | Sets the lore for this item. | 
| void | setUnbreakable(boolean unbreakable) | Sets the unbreakable tag. | 
| void | setVersion(int version) | Deprecated. 
 internal use only | 
serializegetPersistentDataContainerboolean hasDisplayName()
@NotNull @NotNull String getDisplayName()
 Plugins should check that hasDisplayName() returns true
 before calling this method.
void setDisplayName(@Nullable
                    @Nullable String name)
name - the name to setboolean hasLocalizedName()
@NotNull @NotNull String getLocalizedName()
 Plugins should check that hasLocalizedName() returns true
 before calling this method.
void setLocalizedName(@Nullable
                      @Nullable String name)
name - the name to setboolean hasLore()
@Nullable @Nullable List<String> getLore()
 Plugins should check if hasLore() returns true before
 calling this method.
void setLore(@Nullable
             @Nullable List<String> lore)
lore - the lore that will be setboolean hasCustomModelData()
CustomModelData is an integer that may be associated client side with a custom item model.
int getCustomModelData()
CustomModelData is an integer that may be associated client side with a custom item model.
 Plugins should check that hasCustomModelData() returns true
 before calling this method.
void setCustomModelData(@Nullable
                        @Nullable Integer data)
CustomModelData is an integer that may be associated client side with a custom item model.
data - the data to set, or null to clearboolean hasEnchants()
boolean hasEnchant(@NotNull
                   @NotNull Enchantment ench)
ench - enchantment to checkint getEnchantLevel(@NotNull
                    @NotNull Enchantment ench)
ench - enchantment to check@NotNull @NotNull Map<Enchantment,Integer> getEnchants()
boolean addEnchant(@NotNull
                   @NotNull 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(@NotNull
                      @NotNull Enchantment ench)
ench - Enchantment to removeboolean hasConflictingEnchant(@NotNull
                              @NotNull Enchantment ench)
ench - enchantment to testvoid addItemFlags(@NotNull
                  @NotNull ItemFlag... itemFlags)
itemFlags - The hideflags which shouldn't be renderedvoid removeItemFlags(@NotNull
                     @NotNull ItemFlag... itemFlags)
itemFlags - Hideflags which should be removed@NotNull @NotNull Set<ItemFlag> getItemFlags()
boolean hasItemFlag(@NotNull
                    @NotNull ItemFlag flag)
flag - the flag to checkboolean isUnbreakable()
void setUnbreakable(boolean unbreakable)
unbreakable - true if set unbreakableboolean hasAttributeModifiers()
@Nullable @Nullable com.google.common.collect.Multimap<Attribute,AttributeModifier> getAttributeModifiers()
Multimap of Attributes
         and their AttributeModifiers, or null if none exist@NotNull @NotNull com.google.common.collect.Multimap<Attribute,AttributeModifier> getAttributeModifiers(@NotNull @NotNull EquipmentSlot slot)
Attributes and their
 AttributeModifiers for a given EquipmentSlot.AttributeModifier that does have have a given
 EquipmentSlot will be returned. This is because
 AttributeModifiers without a slot are active in any slot.slot - the EquipmentSlot to checkMultimap with the
         respective Attributes and modifiers, or an empty map
         if no attributes are set.@Nullable @Nullable Collection<AttributeModifier> getAttributeModifiers(@NotNull @NotNull Attribute attribute)
AttributeModifiers
 for a given Attributeattribute - the AttributeAttributeModifiers
          or null if no AttributeModifiers exist for the Attribute.NullPointerException - if Attribute is nullboolean addAttributeModifier(@NotNull
                             @NotNull Attribute attribute,
                             @NotNull
                             @NotNull AttributeModifier modifier)
EquipmentSlots.
 If not set, the AttributeModifier will be active in ALL slots.
 AttributeModifiers that have the same UUID
 cannot exist on the same Attribute.attribute - the Attribute to modifymodifier - the AttributeModifier specifying the modificationNullPointerException - if Attribute is nullNullPointerException - if AttributeModifier is nullIllegalArgumentException - if AttributeModifier already existsvoid setAttributeModifiers(@Nullable
                           @Nullable com.google.common.collect.Multimap<Attribute,AttributeModifier> attributeModifiers)
Attributes and their AttributeModifiers.
 To clear all currently set Attributes and AttributeModifiers use
 null or an empty Multimap.
 If not null nor empty, this will filter all entries that are not-null
 and add them to the ItemStack.attributeModifiers - the new Multimap containing the Attributes
                           and their AttributeModifiersboolean removeAttributeModifier(@NotNull
                                @NotNull Attribute attribute)
AttributeModifiers associated with the given
 Attribute.
 This will return false if nothing was removed.attribute - attribute to removeNullPointerException - if Attribute is nullboolean removeAttributeModifier(@NotNull
                                @NotNull EquipmentSlot slot)
Attributes and AttributeModifiers for a
 given EquipmentSlot.EquipmentSlot is null, this will remove all
 AttributeModifiers that do not have an EquipmentSlot set.slot - the EquipmentSlot to clear all Attributes and
             their modifiers forboolean removeAttributeModifier(@NotNull
                                @NotNull Attribute attribute,
                                @NotNull
                                @NotNull AttributeModifier modifier)
Attribute and AttributeModifier.
 AttributeModifiers are matched according to their UUID.attribute - the Attribute to removemodifier - the AttributeModifier to removeNullPointerException - if the Attribute is nullNullPointerException - if the AttributeModifier is nullAttributeModifier.getUniqueId()@NotNull @Deprecated @NotNull CustomItemTagContainer getCustomTagContainer()
PersistentDataHolder API.
 Please use PersistentDataHolder.getPersistentDataContainer() instead of this.@Deprecated void setVersion(int version)
version - version@NotNull @NotNull ItemMeta clone()
Copyright © 2020. All rights reserved.