Astral Realms Documentation Help

Dialog System

The dialog system wraps Paper 1.21's native dialog API, letting you define interactive overlay windows in YAML without writing Java code.

Concepts

Term

Description

DialogBlueprint

The parsed YAML definition. Immutable; shared across all players.

ComputedDialog

A per-player runtime instance. Holds the bound Player and parameter map.

Body

Text or item content displayed in the dialog window.

Input

Interactive widget (text field, toggle, slider, dropdown).

Button

Yes/No action buttons. Each has a label, optional tooltip, width, and action list.

File Layout

Place dialog YAML files in:

plugins/AstralCore/AstralDialogs/ ├── confirm-purchase.yml ├── rename-item.yml └── settings/ └── graphics.yml

Sub-folders are scanned recursively. The file name is irrelevant; use the id field to reference dialogs.

Lifecycle

load() ─── YAML → DialogBlueprint (once, async) │ openMenu() ▼ sync ──────── ComputedDialog.compute() ├── build body sections ├── build input widgets ├── build yes/no buttons with callbacks └── show dialog to player │ Player fills inputs & clicks Yes/No └── button callback fires ├── collect input values → bind as %input.<id>% placeholders └── execute button.actions

Input Value Placeholders

After the player clicks a button, each input's current value is bound as a placeholder %input.<input-id>% and available to all actions inside that button:

inputs: username: type: text label: "Enter a username" yes-button: label: "Confirm" actions: - "[console] rename %player.name% %input.username%"

Opening a Dialog

Via action (from a menu)

actions: LEFT: - "[open-menu] confirm:action=purchase:item=%param.item%"

Wait — dialogs are not menus. To open a dialog from a menu action, use a console or player action to run /astraldialog open <id>, or open it from a Java listener:

AstralCore.get().dialogs().openMenu(player, "confirm-purchase", Map.of("item", itemId));

Via command

/astraldialog open <id>

open-actions / close-actions

open-actions: - "[sound] minecraft:block.note_block.pling" close-actions: - "[message] <gray>Dialog closed."

These fire when the dialog is shown or dismissed (Escape or explicit close).

23 April 2026