XaGui Docs
Interfaces

GuiMenu API

GuiMenuInterface method reference for XaGUI 1.6.1.

Application code can declare menus as GuiMenuInterface; XaGui.createMenu(...) returns concrete GuiMenu.

Lifecycle and information

MethodsNotes
open(Player), open(int, Player)Open page 0 or an explicit page index.
switchPage(int, Player)Switch to a zero-based page.
close(), close(Player)Close all current viewers or one player.
getName(), getRawName(), setName(String)Colored, raw, and mutable title.
getSize()Slot count (rows * 9).
getPages(), getMaxPages()Current page count.
getCurrentPageIndex(), getCurrentPage()Zero-based index and one-based number.
getOwner()Owning JavaPlugin.

Slots

setSlot accepts GuiButtonInterface, ItemStack, or Material, as (slot, value) or (page, slot, value). Related methods:

  • setAllPageSlot(slot, value)
  • updateSlot([page,] slot, ItemStack|Material)
  • getSlot([page,] slot)
  • clearSlot([page,] slot) and clearAllSlots([page])
  • fillSlots(item, slots...) and fillSlots(page, item, slots...)
  • fillBorder(), fillBorder(ItemStack|Material), fillBorder(page, ItemStack)
  • unlockButton([page,] slot) and lockButton([page,] slot)
  • stickSlot(slot) and unStickSlot(slot)

Controls and events

MethodsPurpose
addCloseButton(), addCloseButtonAllPages()Add global close controls.
addCloseButton(page, ItemStack|GuiButtonInterface)Custom close control.
addPaginator()Enable automatic navigation.
setNextPageButton(...), setPreviousPageButton(...)Per-menu icons.
setPageSwitchSound(...), setOpenSound(...)Menu sounds.
setTotalPages(int)Resize the menu.
setOnOpen, setOnClose, setOnClick, setOnClickOwn, setOnPageSwitchEvent handlers.
allowClickTypes, blacklistClickTypesGUI click policy.
setSelfInventoryAccess, allowSelfInventoryClickTypesLower-inventory policy.
setCallback(Runnable), callback()Store and invoke an application callback.

See Slots, Pages, and Events for examples.

On this page