Class AbstractItemBuilder<B extends AbstractItemBuilder<B,C>,C>

java.lang.Object
studio.mevera.lotus.api.item.AbstractItemBuilder<B,C>
Type Parameters:
B - the concrete builder type
C - the display-name/lore component type

public abstract class AbstractItemBuilder<B extends AbstractItemBuilder<B,C>,C> extends Object
Abstract fluent builder for ItemStack instances. Parameterized over:
  • B — the concrete builder type (self-type for fluent method chaining)
  • C — the display-name/lore component type: Component on Paper, String on Spigot

Each platform module provides a concrete ItemBuilder class (same simple name, different package) extending this base:

  • studio.mevera.lotus.paper.ItemBuilder — Paper 1.21+: uses ItemStack.of(), editMeta() lambda, Adventure Component
  • studio.mevera.lotus.spigot.ItemBuilder — Spigot 1.8.8: uses new ItemStack(Material), classic getItemMeta()/setItemMeta(), String with ChatColor translation
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected final org.bukkit.Material
     
    protected boolean
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractItemBuilder(@NotNull org.bukkit.Material material)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    amount(int amount)
    Sets the item stack size.
    abstract @NotNull org.bukkit.inventory.ItemStack
    Builds and returns the configured ItemStack.
    abstract B
    displayName(C name)
    Sets the display name of the item.
    final B
    lore(C... lines)
     
    abstract B
    lore(@NotNull List<C> lines)
    Sets the lore of the item.
    protected final B
    Returns this builder cast to B, enabling fluent method chaining in subclasses.
    unbreakable(boolean value)
    Sets whether this item is unbreakable.

    Methods inherited from class java.lang.Object

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

    • material

      protected final org.bukkit.Material material
    • amount

      protected int amount
    • unbreakable

      protected boolean unbreakable
  • Constructor Details

    • AbstractItemBuilder

      protected AbstractItemBuilder(@NotNull @NotNull org.bukkit.Material material)
  • Method Details

    • self

      @NotNull protected final B self()
      Returns this builder cast to B, enabling fluent method chaining in subclasses.
    • amount

      @NotNull public B amount(int amount)
      Sets the item stack size.
    • unbreakable

      @NotNull public B unbreakable(boolean value)
      Sets whether this item is unbreakable.
    • displayName

      @NotNull public abstract B displayName(@NotNull C name)
      Sets the display name of the item.
      Parameters:
      name - the display name in the platform's component type
    • lore

      @NotNull public abstract B lore(@NotNull @NotNull List<C> lines)
      Sets the lore of the item.
      Parameters:
      lines - the lore lines in the platform's component type
    • lore

      @SafeVarargs @NotNull public final B lore(C... lines)
    • build

      @NotNull public abstract @NotNull org.bukkit.inventory.ItemStack build()
      Builds and returns the configured ItemStack.