Menu System
AstralCore's menu system provides YAML-driven inventory UIs with a rich feature set: dynamic slot assignment, paginated layouts, per-click actions and requirements, template variables, and full placeholder support.
Concepts
Term | Description |
|---|---|
Blueprint | The parsed YAML definition. Immutable; shared across all players. |
Menu | A per-player runtime instance computed from a blueprint. Holds inventory state. |
MenuItem | A single slot configuration inside a blueprint. |
Layout | A dynamic list of items filling a set of slots (used for pagination). |
Variable | A mutable string stored in a menu instance, usable as a placeholder. |
File Layout
Place menu YAML files in:
Sub-folders are scanned recursively. The file name does not matter — the id field inside the YAML is the identifier used to open the menu.
Lifecycle
Opening a Menu
Via command
If the menu blueprint defines an open-command, it is registered as a Bukkit command automatically:
Players run /shop or /store.
Via action
Use the open-menu action inside another menu or dialog:
Via API
Incremental Refresh
Menus support partial updates without re-computing the entire inventory:
Method | Description |
|---|---|
| Re-render a single slot |
| Re-render all slots occupied by an item |
| Re-render a layout and redistribute its items |
| Update a variable and re-render dependent slots |
These are typically triggered from set-variable or refresh-* actions.