Package de.Keyle.MyPet.api.gui
Class IconMenuItem
java.lang.Object
de.Keyle.MyPet.api.gui.IconMenuItem
Deprecated, for removal: This API element is subject to removal in a future version.
Immutable-style model for the appearance of a single inventory slot. Holds
material, title, lore, glow state, and optional NBT tags — everything needed
to build the
ItemStack a slot displays.
Setters return this for fluent chaining. A dirty flag
(hasChanged) tracks whether the item needs re-rendering.
Title and lore support both legacy String and Adventure
Component forms. When both are set, the Component variant
takes precedence during rendering. Setting one clears the other.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intDeprecated, for removal: This API element is subject to removal in a future version.Stack size shown on the slot.protected ItemMetaDeprecated, for removal: This API element is subject to removal in a future version.Bukkit meta copied from a source item, applied on top of the fields above.Deprecated, for removal: This API element is subject to removal in a future version.Adventure lore lines.protected ComponentDeprecated, for removal: This API element is subject to removal in a future version.Adventure title.protected intDeprecated, for removal: This API element is subject to removal in a future version.Legacy data value, kept for compatibility with older item definitions.protected booleanDeprecated, for removal: This API element is subject to removal in a future version.Whether the item renders with the enchantment glint.protected booleanDeprecated, for removal: This API element is subject to removal in a future version.Dirty flag:truewhen the item needs rebuilding before its next render.Deprecated, for removal: This API element is subject to removal in a future version.Legacy string lore lines.protected MaterialDeprecated, for removal: This API element is subject to removal in a future version.The item's material.protected CompoundBinaryTagDeprecated, for removal: This API element is subject to removal in a future version.Extra NBT written onto the built item.protected StringDeprecated, for removal: This API element is subject to removal in a future version.Legacy string title. -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Creates an item with default appearance: a name tag, stack size 1, no title or lore. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Appends all lines from the given list to the legacy lore.addLoreLine(String line) Deprecated, for removal: This API element is subject to removal in a future version.Appends a legacy lore line (supports embedded\n).addLoreLine(String line, int position) Deprecated, for removal: This API element is subject to removal in a future version.Inserts a legacy lore line at the given index.addLoreLine(Component line) Deprecated, for removal: This API element is subject to removal in a future version.Appends a Component lore line.Deprecated, for removal: This API element is subject to removal in a future version.Adds a custom NBT tag entry to this item's tag compound.copy()Deprecated, for removal: This API element is subject to removal in a future version.Returns a deep copy of this item with independent lore lists.static IconMenuItemfromItemStack(ItemStack itemStack) Deprecated, for removal: This API element is subject to removal in a future version.Creates anIconMenuItemfrom an existing Bukkit item.intDeprecated, for removal: This API element is subject to removal in a future version.Stack size shown on the slot.Deprecated, for removal: This API element is subject to removal in a future version.Bukkit meta copied from a source item, applied on top of the fields above.Deprecated, for removal: This API element is subject to removal in a future version.Returns an unmodifiable view of the Component lore lines.Deprecated, for removal: This API element is subject to removal in a future version.Adventure title.intgetData()Deprecated, for removal: This API element is subject to removal in a future version.Legacy data value, kept for compatibility with older item definitions.getLore()Deprecated, for removal: This API element is subject to removal in a future version.Returns an unmodifiable view of the legacy lore lines.Deprecated, for removal: This API element is subject to removal in a future version.The item's material.getTags()Deprecated, for removal: This API element is subject to removal in a future version.Returns the custom NBT tags, ornullif none set.getTitle()Deprecated, for removal: This API element is subject to removal in a future version.Legacy string title.booleanDeprecated, for removal: This API element is subject to removal in a future version.Whether the item renders with the enchantment glint.setAmount(int amount) Deprecated, for removal: This API element is subject to removal in a future version.Sets the stack size displayed in the slot (min 1).setData(int data) Deprecated, for removal: This API element is subject to removal in a future version.Sets the legacy data/damage value (unused on modern servers).setGlowing(boolean glowing) Deprecated, for removal: This API element is subject to removal in a future version.Enables or disables the enchantment glint effect.Deprecated, for removal: This API element is subject to removal in a future version.Replaces all legacy lore with the given lines.setMaterial(Material material) Deprecated, for removal: This API element is subject to removal in a future version.Sets the display material for this menu slot.Deprecated, for removal: This API element is subject to removal in a future version.Applies fields from an existingItemMetaonto this item.Deprecated, for removal: This API element is subject to removal in a future version.Sets the display name as a legacy string.Deprecated, for removal: This API element is subject to removal in a future version.Sets the display name as an Adventure Component.
-
Field Details
-
material
Deprecated, for removal: This API element is subject to removal in a future version.The item's material. Defaults toMaterial.NAME_TAG. -
data
protected int dataDeprecated, for removal: This API element is subject to removal in a future version.Legacy data value, kept for compatibility with older item definitions. -
amount
protected int amountDeprecated, for removal: This API element is subject to removal in a future version.Stack size shown on the slot. -
title
Deprecated, for removal: This API element is subject to removal in a future version.Legacy string title. Cleared when aComponenttitle is set. -
lore
Deprecated, for removal: This API element is subject to removal in a future version.Legacy string lore lines. Cleared when component lore is set. -
componentTitle
Deprecated, for removal: This API element is subject to removal in a future version.Adventure title. Takes precedence over the string title when both are present. -
componentLore
Deprecated, for removal: This API element is subject to removal in a future version.Adventure lore lines. Take precedence over the string lore when both are present. -
glowing
protected boolean glowingDeprecated, for removal: This API element is subject to removal in a future version.Whether the item renders with the enchantment glint. -
bukkitMeta
Deprecated, for removal: This API element is subject to removal in a future version.Bukkit meta copied from a source item, applied on top of the fields above. -
tag
Deprecated, for removal: This API element is subject to removal in a future version.Extra NBT written onto the built item. -
hasChanged
protected boolean hasChangedDeprecated, for removal: This API element is subject to removal in a future version.Dirty flag:truewhen the item needs rebuilding before its next render.
-
-
Constructor Details
-
IconMenuItem
public IconMenuItem()Deprecated, for removal: This API element is subject to removal in a future version.Creates an item with default appearance: a name tag, stack size 1, no title or lore.
-
-
Method Details
-
fromItemStack
Deprecated, for removal: This API element is subject to removal in a future version.Creates anIconMenuItemfrom an existing Bukkit item.- Parameters:
itemStack- the item to copy material, amount and meta from- Returns:
- a new icon matching that item
-
setMeta
Deprecated, for removal: This API element is subject to removal in a future version.Applies fields from an existingItemMetaonto this item.- Parameters:
meta- the source metauseTitle- iftrue, copies the display nameuseLore- iftrue, copies the lore lines- Returns:
- this item, for chaining
-
addLoreLine
Deprecated, for removal: This API element is subject to removal in a future version.Appends a legacy lore line (supports embedded\n).- Parameters:
line- the line to append; embedded\\nsplits it into several- Returns:
- this item, for chaining
-
addLoreLine
Deprecated, for removal: This API element is subject to removal in a future version.Inserts a legacy lore line at the given index.- Parameters:
line- the line to insertposition- index to insert it at- Returns:
- this item, for chaining
-
addLore
Deprecated, for removal: This API element is subject to removal in a future version.Appends all lines from the given list to the legacy lore.- Parameters:
lore- the lines to append- Returns:
- this item, for chaining
-
setMaterial
Deprecated, for removal: This API element is subject to removal in a future version.Sets the display material for this menu slot.- Parameters:
material- the material to display- Returns:
- this item, for chaining
-
setData
Deprecated, for removal: This API element is subject to removal in a future version.Sets the legacy data/damage value (unused on modern servers).- Parameters:
data- the legacy data value- Returns:
- this item, for chaining
-
setAmount
Deprecated, for removal: This API element is subject to removal in a future version.Sets the stack size displayed in the slot (min 1).- Parameters:
amount- the stack size to show- Returns:
- this item, for chaining
-
setTitle
Deprecated, for removal: This API element is subject to removal in a future version.Sets the display name as a legacy string. Clears any Component title.- Parameters:
title- the legacy title; clears any component title- Returns:
- this item, for chaining
-
setTitle
Deprecated, for removal: This API element is subject to removal in a future version.Sets the display name as an Adventure Component. Clears any legacy title.- Parameters:
title- the component title; clears any legacy title and takes precedence when rendering- Returns:
- this item, for chaining
-
getLore
Deprecated, for removal: This API element is subject to removal in a future version.Returns an unmodifiable view of the legacy lore lines.- Returns:
- the legacy lore lines
-
getComponentLore
Deprecated, for removal: This API element is subject to removal in a future version.Returns an unmodifiable view of the Component lore lines.- Returns:
- the component lore lines, which take precedence over the legacy ones
-
addLoreLine
Deprecated, for removal: This API element is subject to removal in a future version.Appends a Component lore line. Clears any legacy lore.- Parameters:
line- the component line to append; clears any legacy lore- Returns:
- this item, for chaining
-
setLore
Deprecated, for removal: This API element is subject to removal in a future version.Replaces all legacy lore with the given lines.- Parameters:
lore- the lines to use, replacing whatever was there- Returns:
- this item, for chaining
-
setGlowing
Deprecated, for removal: This API element is subject to removal in a future version.Enables or disables the enchantment glint effect.- Parameters:
glowing-trueto render the enchantment glint- Returns:
- this item, for chaining
-
addTag
Deprecated, for removal: This API element is subject to removal in a future version.Adds a custom NBT tag entry to this item's tag compound.- Parameters:
key- the NBT keytag- the value to write- Returns:
- this item, for chaining
-
getTags
Deprecated, for removal: This API element is subject to removal in a future version.Returns the custom NBT tags, ornullif none set.- Returns:
- the NBT written onto the built item
-
copy
Deprecated, for removal: This API element is subject to removal in a future version.Returns a deep copy of this item with independent lore lists.- Returns:
- an independent copy of this item
-
getMaterial
Deprecated, for removal: This API element is subject to removal in a future version.The item's material. Defaults toMaterial.NAME_TAG.- Returns:
- the material this item renders as
-
getData
public int getData()Deprecated, for removal: This API element is subject to removal in a future version.Legacy data value, kept for compatibility with older item definitions.- Returns:
- the legacy data value
-
getAmount
public int getAmount()Deprecated, for removal: This API element is subject to removal in a future version.Stack size shown on the slot.- Returns:
- the stack size
-
getTitle
Deprecated, for removal: This API element is subject to removal in a future version.Legacy string title. Cleared when aComponenttitle is set.- Returns:
- the legacy title, or an empty string when a component title is set
-
getComponentTitle
Deprecated, for removal: This API element is subject to removal in a future version.Adventure title. Takes precedence over the string title when both are present.- Returns:
- the component title, or
nullwhen only a legacy title is set
-
isGlowing
public boolean isGlowing()Deprecated, for removal: This API element is subject to removal in a future version.Whether the item renders with the enchantment glint.- Returns:
trueif the glint is drawn
-
getBukkitMeta
Deprecated, for removal: This API element is subject to removal in a future version.Bukkit meta copied from a source item, applied on top of the fields above.- Returns:
- the copied meta, or
nullif none was supplied
-
ItemAppearancerecord instead. Use that for new code.