Class ViewItem
java.lang.Object
me.agent.vgui.api.item.ViewItem
An item shown in a view slot, optionally with a click handler. Immutable; safe to
share between slots, views and players.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ViewItembackButton(com.github.retrooper.packetevents.protocol.item.ItemStack item) An item that returns to the previous view (or closes if there is none) when clicked.static ViewItemclickable(com.github.retrooper.packetevents.protocol.item.ItemStack item, Consumer<ClickContext> onClick) An item that runsonClickwhen clicked.static ViewItemclickable(ItemBuilder builder, Consumer<ClickContext> onClick) An item built from anItemBuilderthat runsonClickwhen clicked.static ViewItemcloseButton(com.github.retrooper.packetevents.protocol.item.ItemStack item) An item that closes the view when clicked.voidhandle(ClickContext ctx) Runs the click handler, if any.booleanWhether this item has a click handler.com.github.retrooper.packetevents.protocol.item.ItemStackitem()A defensive copy of the displayed item stack.static ViewItemof(com.github.retrooper.packetevents.protocol.item.ItemStack item) A display-only item without a click handler.static ViewItemof(ItemBuilder builder) A display-only item built from anItemBuilder.static ViewItemAn item that opens a lazily-created view (pushing back-history) when clicked.static ViewItemAn item that opens another view (pushing back-history) when clicked.static ViewItempageNext(com.github.retrooper.packetevents.protocol.item.ItemStack item) An item that advances the view'sPaginationone page.static ViewItempagePrevious(com.github.retrooper.packetevents.protocol.item.ItemStack item) An item that goes back one page in the view'sPagination.withClick(Consumer<ClickContext> onClick) A copy of this item with a different click handler (nullremoves it).withItem(com.github.retrooper.packetevents.protocol.item.ItemStack item) A copy of this item with a different item stack.
-
Method Details
-
of
A display-only item without a click handler. -
of
A display-only item built from anItemBuilder. -
clickable
public static ViewItem clickable(com.github.retrooper.packetevents.protocol.item.ItemStack item, Consumer<ClickContext> onClick) An item that runsonClickwhen clicked. -
clickable
An item built from anItemBuilderthat runsonClickwhen clicked. -
closeButton
An item that closes the view when clicked. -
backButton
An item that returns to the previous view (or closes if there is none) when clicked. -
pageNext
An item that advances the view'sPaginationone page. -
pagePrevious
An item that goes back one page in the view'sPagination. -
opens
-
opens
-
withClick
A copy of this item with a different click handler (nullremoves it). -
withItem
A copy of this item with a different item stack. -
item
public com.github.retrooper.packetevents.protocol.item.ItemStack item()A defensive copy of the displayed item stack. -
hasHandler
public boolean hasHandler()Whether this item has a click handler. -
handle
Runs the click handler, if any.
-