Class IconMenuItem

java.lang.Object
de.Keyle.MyPet.api.gui.IconMenuItem

@Deprecated(since="4.1.0", forRemoval=true) public class IconMenuItem extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
MyPet no longer uses this builder; the menus describe a slot with the immutable ItemAppearance record instead. Use that for new code.
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

    Fields
    Modifier and Type
    Field
    Description
    protected int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Stack size shown on the slot.
    protected ItemMeta
    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.
    protected final List<Component>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Adventure lore lines.
    protected Component
    Deprecated, for removal: This API element is subject to removal in a future version.
    Adventure title.
    protected int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Legacy data value, kept for compatibility with older item definitions.
    protected boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Whether the item renders with the enchantment glint.
    protected boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Dirty flag: true when the item needs rebuilding before its next render.
    protected final List<String>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Legacy string lore lines.
    protected Material
    Deprecated, for removal: This API element is subject to removal in a future version.
    The item's material.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Extra NBT written onto the built item.
    protected String
    Deprecated, for removal: This API element is subject to removal in a future version.
    Legacy string title.
  • Constructor Summary

    Constructors
    Constructor
    Description
    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 Summary

    Modifier and Type
    Method
    Description
    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.
    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.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Appends a Component lore line.
    addTag(String key, BinaryTag tag)
    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.
    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.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates an IconMenuItem from an existing Bukkit item.
    int
    Deprecated, 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.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Legacy data value, kept for compatibility with older item definitions.
    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.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the custom NBT tags, or null if none set.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Legacy string title.
    boolean
    Deprecated, 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.
    setLore(String... lore)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Replaces all legacy lore with the given lines.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sets the display material for this menu slot.
    setMeta(ItemMeta meta, boolean useTitle, boolean useLore)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Applies fields from an existing ItemMeta onto 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • material

      protected Material material
      Deprecated, for removal: This API element is subject to removal in a future version.
      The item's material. Defaults to Material.NAME_TAG.
    • data

      protected int data
      Deprecated, 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 amount
      Deprecated, for removal: This API element is subject to removal in a future version.
      Stack size shown on the slot.
    • title

      protected String title
      Deprecated, for removal: This API element is subject to removal in a future version.
      Legacy string title. Cleared when a Component title is set.
    • lore

      protected final List<String> 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

      protected Component 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

      protected final List<Component> 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 glowing
      Deprecated, for removal: This API element is subject to removal in a future version.
      Whether the item renders with the enchantment glint.
    • bukkitMeta

      protected ItemMeta 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

      protected CompoundBinaryTag 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 hasChanged
      Deprecated, for removal: This API element is subject to removal in a future version.
      Dirty flag: true when 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

      public static IconMenuItem fromItemStack(ItemStack itemStack)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates an IconMenuItem from an existing Bukkit item.
      Parameters:
      itemStack - the item to copy material, amount and meta from
      Returns:
      a new icon matching that item
    • setMeta

      public IconMenuItem setMeta(ItemMeta meta, boolean useTitle, boolean useLore)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Applies fields from an existing ItemMeta onto this item.
      Parameters:
      meta - the source meta
      useTitle - if true, copies the display name
      useLore - if true, copies the lore lines
      Returns:
      this item, for chaining
    • addLoreLine

      public IconMenuItem 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).
      Parameters:
      line - the line to append; embedded \\n splits it into several
      Returns:
      this item, for chaining
    • addLoreLine

      public IconMenuItem 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.
      Parameters:
      line - the line to insert
      position - index to insert it at
      Returns:
      this item, for chaining
    • addLore

      public IconMenuItem addLore(List<String> lore)
      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

      public IconMenuItem 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.
      Parameters:
      material - the material to display
      Returns:
      this item, for chaining
    • setData

      public IconMenuItem 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).
      Parameters:
      data - the legacy data value
      Returns:
      this item, for chaining
    • setAmount

      public IconMenuItem 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).
      Parameters:
      amount - the stack size to show
      Returns:
      this item, for chaining
    • setTitle

      public IconMenuItem setTitle(String title)
      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

      public IconMenuItem setTitle(Component title)
      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

      public List<String> 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

      public List<Component> 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

      public IconMenuItem addLoreLine(Component line)
      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

      public IconMenuItem setLore(String... lore)
      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

      public IconMenuItem setGlowing(boolean glowing)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Enables or disables the enchantment glint effect.
      Parameters:
      glowing - true to render the enchantment glint
      Returns:
      this item, for chaining
    • addTag

      public IconMenuItem addTag(String key, BinaryTag tag)
      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 key
      tag - the value to write
      Returns:
      this item, for chaining
    • getTags

      public CompoundBinaryTag getTags()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the custom NBT tags, or null if none set.
      Returns:
      the NBT written onto the built item
    • copy

      public IconMenuItem 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

      public Material getMaterial()
      Deprecated, for removal: This API element is subject to removal in a future version.
      The item's material. Defaults to Material.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

      public String getTitle()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Legacy string title. Cleared when a Component title is set.
      Returns:
      the legacy title, or an empty string when a component title is set
    • getComponentTitle

      public Component 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 null when 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:
      true if the glint is drawn
    • getBukkitMeta

      public ItemMeta 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 null if none was supplied