GUI
Chest menus with pages, per-player items, click actions, item-input slots and the shared ALB theme.
Docs updated · What changed
GuiBuilder creates chest menus (1 to 6 rows). Chest menus work for Bedrock players through Geyser. Create a new GuiBuilder each time you open a menu for a player, and use it on the main thread.
Pages and itemsLink to this section
val gui = GuiBuilder("&8Skills · &7%player_name%", 6)
gui.global { // on every page
item(45) { _, ctx -> GuiItem(backArrow) { _, c -> c.previousPage() } }
item(53) { _, ctx -> GuiItem(if (ctx.hasNextPage) nextArrow else filler) { _, c -> c.nextPage() } }
}
.page { // page 1
item(10..16) { player, _ ->
GuiItem(skillIcon(player)) { p, ctx -> levelUp(p); ctx.refresh() }
}
}
.page { item(10) { _, _ -> GuiItem(moreIcon) } } // page 2
.setItem(49, { player -> closeButton(player) }) { player -> player.closeInventory() }
.refreshEvery(20) // ticks; only while open
gui.open(player)Item-input slotsLink to this section
Everything in a GUI is locked except slots you open with allowItemPlacement. Shift-click, double-click, number keys, the offhand key and dragging are all checked against the slot filters.
val sell = GuiBuilder("&8Sell items", 4)
sell.allowItemPlacement(0..26) { item -> PriceRegistry.hasPrice(item.type) }
.setItem(31, { sellButton }) { player -> sellAll(player, sell.getItems(0..26)); sell.clearItems(0..26) }
.onClose { player -> player.inventory.addItem(*sell.getItems(0..26).toTypedArray()) }
sell.open(player)GuiBuilder referenceLink to this section
| Member | What it does |
|---|---|
global { }, page { } | Items shown on every page / on one page. item(slot), item(vararg slots), item(range). |
setItem(slot, item, action) | A fixed slot rebuilt for the viewer on each refresh. |
onOpen, onClose | Callbacks with the player. |
refresh(), goToPage(i), close(), isOpen() | Runtime control. |
getItems, addItem(s), clearItems | Read or change slot contents. |
PageContext | currentPage, totalPages, hasNextPage, hasPreviousPage, nextPage(), previousPage(), goTo(i), refresh(). |
Themed menusLink to this section
Every ALB menu shares one look: a cyan frame on the edge, the header in slot 4, back or close at the bottom centre and the page buttons next to it. The items come from plugins/ALBCore/menus/common.yml and the shared texts from plugins/ALBCore/lang.yml (gui.*), so changing those files restyles every plugin's menus.
GuiBuilder("&8ʜᴏᴍᴇꜱ", 6)
.frame() // theme panes on the edge, under everything else
.header(headerItem) // slot 4
.list(GuiLayout.inner(6), entries = { homesOf(player) }) { viewer, home ->
GuiItem.button(icon(home)) { click -> // click sound, then the action
if (click.isRight) manage(click.player, home) else teleport(click.player, home)
}
}
.pageButtons() // previous / next, only when there is such a page
.backOrClose(back) // back button, or close when back is null
.pagedTitle() // "Homes (2/3)" when there is more than one page
.open(player)- Every click action gets a per-player cooldown (
gui.click-cooldown-msin config.yml, default 100;clickCooldown(ms)per GUI). The second half of a double-click is ignored. GuiClick(frombutton,GuiItem.button,gui.clickorPageContext.click) has the player, click type, slot and GUI:isLeft,isRight,isShift,isDrop.GuiSounds.click / toggled(player, on) / denied / successuse the sounds in config.ymlgui.sounds.GuiTheme:frame(),corner(),pane(item),button("back" | "close" | "previous" | "next"),text("status-on"),lines("toggle-hint").GuiLayout:bottom(rows),inner(rows),pageCount,centered.- A title with
{page}/{pages}(orpagedTitle()) re-opens the GUI on a page change; items in input slots are kept andonOpen/onClosedo not run. GuiBuilder.refreshOpen { player -> ... }redraws the open ALB GUI of every matching player.