Class GuiItem

java.lang.Object
com.github.darksoulq.abyssallib.world.gui.element.GuiItem
All Implemented Interfaces:
GuiElement
Direct Known Subclasses:
GuiButton

public class GuiItem extends Object implements GuiElement
A static, non-interactive GUI element.

This element is used to display an item that cannot be picked up or interacted with by the player. It is ideal for background fillers, info icons, and decorative borders.

  • Constructor Details

    • GuiItem

      public GuiItem(org.bukkit.inventory.ItemStack item)
      Constructs a new GuiItem.
      Parameters:
      item - the item to display
  • Method Details

    • render

      @Nullable public @Nullable org.bukkit.inventory.ItemStack render(GuiView view, int slot)
      Renders the static item to the view.
      Specified by:
      render in interface GuiElement
      Parameters:
      view - the current GUI view
      slot - the slot index
      Returns:
      the item stack to display
    • onClick

      public ActionResult onClick(GuiClickContext ctx)
      Cancels the click action to prevent the item from being taken.
      Specified by:
      onClick in interface GuiElement
      Parameters:
      ctx - the click context
      Returns:
      ActionResult.CANCEL
    • onDrag

      public ActionResult onDrag(GuiDragContext ctx)
      Cancels the drag action to prevent item placement in this slot.
      Specified by:
      onDrag in interface GuiElement
      Parameters:
      ctx - the drag context
      Returns:
      ActionResult.CANCEL
    • of

      public static GuiItem of(org.bukkit.inventory.ItemStack item)
      Static factory method to create a GuiItem.
      Parameters:
      item - the item stack
      Returns:
      a new GuiItem instance