ALB Studio

YAML menus

Menus that admins can edit in plugins/<Plugin>/menus/, with actions, placeholders and an in-game editor.

Docs updated · What changed

On this page

A plugin can keep its menus in plugins/<Plugin>/menus/<id>.yml, so admins can change titles, items, slots and actions without a new jar.

Built-in menus ship in the jar as src/main/resources/menus/<id>.yml and are copied when missing. Bump revision: in the jar copy when you redesign a menu: the server copy is kept as <id>.old.yml and replaced. The format is described at the top of ALBCore's menus/common.yml.

menus/homes.yml
title: "&8ʜᴏᴍᴇꜱ"
rows: 6
fill: edges                       # none | edges | all
items:
  header: { slot: 4, item: RED_BED, name: "&#7DD3FC&lHomes", lore: ["&7{count}/{max} homes"] }
  add:
    slot: 51
    item: LIME_DYE
    name: "&#4ADE80+ New home"
    actions: ["[function] sethome"]
    permission: homes.set
    locked: { hide: false, item: GRAY_DYE, name: "&8Rank needed", actions: ["[sound] entity.villager.no"] }
  back: { slot: 49, item: ARROW, name: "&#7DD3FC← Back", actions: ["[back]"] }
list:
  slots: "10-16,19-25,28-34"
  layout: centered
  look:
    home: { name: "&f{name}", lore: ["&7{world}", "", "&#7DD3FC» &fClick &7to go there"] }

Opening it from codeLink to this section

Kotlin
val menus = Menus(this, builtIn = listOf("homes"), lang = lang)
menus.function("sethome", permission = "homes.set") { click -> askName(click.player) }
menus.opener("homes") { player, back -> openHomes(player, back) }   // "[open] homes" runs this

fun openHomes(player: Player, back: ((Player) -> Unit)?) {
    val def = menus.get("homes")
    menus.open(player, def, MenuContext(
        back = back,
        placeholders = { listOf("count" to homesOf(it).size, "max" to maxHomes(it)) },
        entries = { homesOf(player).map { home ->
            MenuEntry({ v -> def.entry("home", null, ItemStack(Material.RED_BED), listOf("name" to home.name, "world" to home.world), viewer = v) }) {
                click -> teleport(click.player, home)
            }
        } },
    ))
}

ActionsLink to this section

ActionDoes
[close], [back]Close the menu / go to the menu it was opened from.
[open] <menu>, [open] <plugin>:<menu>Another menu (its opener if one is registered, else the file as it is).
[next-page], [previous-page], [refresh]Page of the list area (the item hides when there is no such page) / redraw.
[function] <id>Plugin code: MenuContext.functions, then menus.function. Its permission is checked first.
[player] <cmd>, [console] <cmd>, [message] <text>, [sound] <key> [volume] [pitch]Commands, a chat message, a sound. Without a [sound] the theme click sound plays.

Plugins whose menus are only known at run time (add-ons) can route actions themselves: menus.router { player, id, back -> true } is asked first for every [open], and menus.functionRouter { click, id, back -> true } runs [function] ids that nothing else knows.

PlaceholdersLink to this section

{player}, {prefix}, {page}, {pages} and the menu's own. A lore line that is only a list placeholder becomes one line per value. item-data: "data:<base64>" keeps an exact item (Nexo items).

Shared menu editorLink to this section

Since 1.3.0

Kotlin
MenuEditor.forMenus(plugin, menus,
    functions = { menuId -> listOf(EditorFunction("toggle-chat", Material.LEVER, "&fToggle chat")) },
    exit = { openHub(it) },
).list(player)

This opens the in-game editor every ALB plugin shares: items (from hand), names, lore, glow, actions, permission and locked look, rearrange, list slots, entry looks and icons, title, rows, filler, reset. Changes save to the file at once.

  • MenuEditor(MenuEditorSpec(...)) with custom = CustomMenuSupport(...) also lets admins make menus with their own command.
  • The plugin decides who may open it.
  • Texts: lang.yml menu-editor.

Type a class, method, config key or topic. Use the arrow keys and Enter to open a result.