Class GuiItem
java.lang.Object
com.github.darksoulq.abyssallib.world.gui.element.GuiItem
- All Implemented Interfaces:
GuiElement
- Direct Known Subclasses:
GuiButton
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GuiItemof(org.bukkit.inventory.ItemStack item) Static factory method to create a GuiItem.onClick(GuiClickContext ctx) Cancels the click action to prevent the item from being taken.onDrag(GuiDragContext ctx) Cancels the drag action to prevent item placement in this slot.@Nullable org.bukkit.inventory.ItemStackRenders the static item to the view.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface GuiElement
onClick, onDrag
-
Constructor Details
-
GuiItem
public GuiItem(org.bukkit.inventory.ItemStack item) Constructs a new GuiItem.- Parameters:
item- the item to display
-
-
Method Details
-
render
Renders the static item to the view.- Specified by:
renderin interfaceGuiElement- Parameters:
view- the current GUI viewslot- the slot index- Returns:
- the item stack to display
-
onClick
Cancels the click action to prevent the item from being taken.- Specified by:
onClickin interfaceGuiElement- Parameters:
ctx- the click context- Returns:
ActionResult.CANCEL
-
onDrag
Cancels the drag action to prevent item placement in this slot.- Specified by:
onDragin interfaceGuiElement- Parameters:
ctx- the drag context- Returns:
ActionResult.CANCEL
-
of
Static factory method to create a GuiItem.- Parameters:
item- the item stack- Returns:
- a new GuiItem instance
-