Dialogs
Dialog Engine
Dialog Engine is a server plugin for Minecraft's dialog screens: the real menus the game has had since 1.21.6, with text, items, text boxes, dropdowns, switches, sliders and buttons. You write a dialog in YAML, and the plugin opens it, fills it in for each player and runs whatever its buttons say.

- Server owners write dialogs in a folder and give them commands, permissions, conditions, lists and actions. No code.
- Developers ship dialogs with their own plugin, add their own actions, placeholders and lists, and hear every press of a YAML dialog's buttons as an event.
A dialog is drawn by the game itself, so it needs no resource pack. The one exception is a drawn dialog, which is a picture designed in the browser and comes with a small pack of its own.
Dialog Engine or RP Engine?
RP Engine has dialogs too, but the two plugins don't
share or sync them: a Dialog Engine dialog opens with /de open, an RP
Engine one with /rp dialog. Use Dialog Engine when dialogs are all you
need, or you want text boxes, conditions, lists and a click event in Java.
For a screen with a mouse pointer written in HTML, see MC GUI.
Which plugin for menus compares them all.
Installing#
- 1
Get the jar
Download Dialog Engine from SpigotMC.
- 2
Drop it in
Put the jar in
plugins/and restart. It runs on Spigot, Paper or Folia 1.21.7 or newer (one jar for all three; Folia since 0.7.0) and needs Java 21. Players need a 1.21.6 or newer client. PlaceholderAPI is optional. On an older server the plugin says so in the console and turns itself off. - 3
Look at what it made
plugins/DialogEngine/ config.yml AI-GUIDE.md ← the format, written for an AI assistant dialogs/ ← your dialogs samples/ ← working examples drawn/ ← drawn dialogs samples/
What talks to the internet
update-check asks SpigotMC for the latest version. telemetry sends an
anonymous count every 30 seconds: a random id, the number of players online
and the names of plugins that depend on Dialog Engine. Both can be turned off
in config.yml.
Drawn dialogs also go online: /de edit, and a
dialog.yml you edited by hand, send that one dialog to the editor to be
drawn. Plain YAML dialogs never leave the server.
Your first dialog#
- 1
Make a file
plugins/DialogEngine/dialogs/myserver/hello.yml:hello: command: hello title: "<gold><bold>Hello" body: - "<gray>Welcome, <white>{player}</white>. There are {online} of us online." buttons: - label: "<green>Thanks" actions: - "[message] <green>Have fun!" - "[close]"That is the dialog
myserver:hello: the folder is the namespace and the key is the name. - 2
Reload
Run
/de reload. It says how many dialogs loaded and lists every problem it found, with the file each one is in. - 3
Open it
Type
/hello, or/de open myserver:hello, which works on any dialog whether it has a command or not.
Writing dialogs with an AI
plugins/DialogEngine/AI-GUIDE.md is rewritten on every start. It is the
whole format plus the rules that catch the usual mistakes. Hand it to an AI
assistant along with what you want the screen to do.
Where dialogs live#
Every folder in dialogs/ is a namespace, and every top-level key in a
.yml file inside it is a dialog: welcome in dialogs/samples/menus.yml
is samples:welcome. Subfolders stay in the same namespace. Files directly in
dialogs/ are in the namespace server.
- Names are lower case:
a-z,0-9,_,.and-. The same name twice in one namespace is reported, and the later one wins. - When one dialog names another (
[open] confirm,if-missing: pick), a name without a namespace means one in the same namespace. - Text is MiniMessage
(
<gold>,<bold>,<#3670f8>), never&codes. - Quote any string that starts with
<,[,{,%or*, or contains:, or YAML will read it as something else.
The format#
A complete dialog, a shop with a slider:
shop:
command: shop # /shop opens it (optional)
aliases: [store]
permission: myserver.shop # who may open it themselves (optional)
title: "<gold><bold>Shop"
columns: 2 # buttons side by side
body:
- "<gray>You have <white>%vault_eco_balance%</white> coins." # a line of text
- item: diamond # an item, with words beside it
name: "<aqua>Diamond"
description: "<gray>A coin each"
inputs:
- key: amount
type: slider
label: "How many"
min: 1
max: 64
step: 1
initial: 16
buttons:
- label: "<green>Buy"
tooltip: "Buy {amount} diamonds"
actions:
- "[if] %vault_eco_balance% >= {amount}" # stop unless they can pay
- "[console] eco take {player} {amount}"
- "[console] give {player} diamond {amount}"
- "[message] <green>Bought {amount} diamonds."
- "[close]"
exit: # the button Escape also presses
label: "Close"Dialog keys#
| Key | What it does |
|---|---|
title: | The heading |
external-title: | A shorter title for where the game names the dialog outside it, such as a button that opens it |
command:, aliases: | A command that opens it. See Its own command |
permission: | What a player needs to open it themselves |
args:, if-missing: | Command arguments that become placeholders, and the dialog to open when one is left out. See A dialog about somebody |
defaults: | Starting values, as key: value |
type: | notice, confirmation, multi_action (or menu) or links. Leave it out and the buttons decide |
columns: | Buttons side by side. Default 2 |
escape: | Whether Escape closes it. Default true |
hide-button: | Hides the button at the bottom. It is still there. See Hide button |
pause: | Whether it pauses a single-player game. Default false. Ignored with after: none or seamless |
after: | What happens on screen when a button is pressed: seamless, wait, close or none. See After a click |
body: | What is drawn above the inputs. See Body |
inputs: | See Inputs |
buttons:, exit: | See Buttons. exit: is the bottom button, which Escape also presses |
lists: | Rows the dialog can repeat over. See Lists and pages |
json: | Send a file of the game's own dialog JSON instead. See Raw JSON dialogs |
Types#
The layout follows the buttons. One button and no exit: is a notice (a notice
with no button at all gets the game's Ok button). More buttons make a grid,
columns: wide, with the exit: button under it.
For a yes/no screen, write confirm: and cancel: in place of buttons: (or
say type: confirmation). type: links is the game's server links screen.
Hide button#
hide-button: true hides a notice's button (0.8.2+), for a dialog that closes
another way: Escape, or a click in the body. It works with one button (or
exit:), or none, when the hidden one closes it as Ok would. With more it does
nothing and the console says so. It needs the resource
pack, which is then built even with no drawn dialogs, and
sent to a player the first time they open such a dialog.
The button is still there
It is hidden, not removed: the game will not open a dialog without one. Escape still presses it, so does a click on the two pixels at the bottom middle where it sits, and the empty strip it sat in stays. A player who has not loaded the pack sees a thin sliver.
rules_decline:
title: "Decline the rules?"
escape: false
body:
- "<gray>You can't play here without accepting them."
confirm:
label: "<red>Leave"
actions: ["[console] kick {player} You need to accept the rules to play."]
cancel:
label: "Read them again"
actions: ["[back]"]Body#
A body entry is a string (one line of text) or a map:
| Key | What it does |
|---|---|
text: | MiniMessage. A list is several lines. width: 1 to 1024, default 200 |
item: | An item id, drawn with description: beside it. Also takes name:, lore:, amount:, model: (an item model id), custom-model-data:, glow:, tooltip: (false turns off its hover tooltip), decorations: (false hides its count and durability bar), and width:/height: 1 to 256 |
head: | A player's name, drawn as their head |
if: | Only drawn when this holds. See Conditions |
for-each: | Drawn once per row of a list. See Lists and pages |
body:
- head: "{target}"
width: 24
height: 24
description: "<gray>Tell us what <white>{target}</white> did."
- text:
- "<white>1.</white> <gray>Be kind."
- "<white>2.</white> <gray>No cheats."
width: 260An item from ItemsAdder, Nexo, Oraxen or your own resource pack is drawn as
itself with model: or custom-model-data:, the same way the plugin gives the
real item:
body:
- item: paper
model: nexo:ruby # its item model
- item: paper
custom-model-data: 1001 # a custom model data number
- item: paper
custom-model-data: # or the game's own lists, by name
floats: [1001]
strings: ["{gem}"] # placeholders are filled firstInputs#
type: | Keys | What {key} holds |
|---|---|---|
text | max-length, initial, and lines and height for a text area | What was typed |
options | options:, a list of {id, text, initial} (or - id: Text), or a for-each | The chosen id. {key.label} is its text |
toggle | initial, on-true, on-false | true or false. {key.text} is on-true or on-false |
slider | min, max, step, initial, format (a translation key) | The number |
Every input needs a key: of letters, digits and _, and also takes label:,
label-visible:, width: and if:.
A text input can be checked with required: true, min-length:, pattern: (a
Java regex the whole value must match) and error: (the message). When a
button is pressed and a check fails, the dialog is drawn again with the typed
text still in it and the message on top. The message is also {error}, so the
dialog can print it where it likes. A button with validate: false skips the
checks, which suits a Cancel button. The exit: button never checks.
inputs:
- key: reason
type: options
label: "Reason"
options:
- { id: cheating, text: "Cheating", initial: true }
- { id: chat, text: "Chat abuse" }
- key: details
type: text
label: "What happened?"
lines: 3
height: 48
max-length: 200
required: true
min-length: 10
error: "Tell us a little more: at least 10 characters."What a player typed is escaped wherever it is printed, so nobody can put a color or a click into somebody else's screen.
Buttons#
| Key | What it does |
|---|---|
label: | Its text |
tooltip: | Shown on hover |
width: | 1 to 1024, default 150 |
permission: | Hidden from a player without it |
if: | Only shown when this holds |
for-each: | One button per row of a list |
validate: | false skips the input checks |
id: | A name for your own plugin to recognize it by |
actions: | What it does. See Actions |
A button that does one thing can use a shorthand instead of actions::
command:, console:, open:, url:, copy:, suggest:, message:,
close: true or back: true.
buttons:
- label: "Warps"
open: warps
- label: "Website"
url: "https://example.com"
- label: "Close"
close: trueActions#
A button's actions: run in order. A line without a [tag] is a command the
player runs.
| Action | What it does |
|---|---|
[player] cmd | The player runs it, with their own permissions |
[console] cmd | The console runs it |
[message] text | Tells the player |
[broadcast] text | Tells everybody |
[actionbar] text | Shows it above the hotbar |
[title] title | subtitle | Shows a title |
[sound] id [volume] [pitch] | Plays a sound: [sound] entity.experience_orb.pickup 1 1.4 |
[open] id [key=value ...] | Opens another dialog, carrying this one's values and inputs over |
[back] | Returns to the dialog this one was opened from, as it was |
[refresh] | Draws this one again, with what was typed still in it |
[page] next|prev|first|last|N | Turns the page of a paged list |
[set] key=value ... | Sets a value for the actions after it, and for any dialog opened |
[clear] [keys] | Forgets what was typed: every input, or the keys named |
[close] | Closes the dialog |
[delay] ticks | Waits before the rest. 20 ticks is a second |
[if] condition | Stops here unless it holds |
[permission] node | Stops here unless the player has it |
[stop] | Stops here |
[url] link | Opens a link |
[copy] text | Copies to the clipboard |
[suggest] /cmd | Puts a command in the chat box, ready to finish |
[event] id | Nothing by itself: it names the click id for your plugin's DialogClickEvent. Placeholders work: [event] buy_{row.id} |
[myplugin:tag] ... | Whatever another plugin registered |
[url], [copy] and [suggest] are the game's own button actions, so they
only work as described when they are a button's only action. Mixed with
others, [url] sends the link in chat instead, and [copy] and [suggest] do
nothing.
After a click#
What the screen does the moment a button is pressed is the dialog's after:,
or default-after in config when it does not say:
seamless(the default): the dialog stays exactly as it is until the plugin answers. The next dialog replaces it with nothing in between, and if none follows, the plugin closes it. A button that runs a command closes the dialog first, unless a later action opens another, so a screen that command opens (a chest, another plugin's menu) is not closed by mistake.wait: the game's "Waiting for Server" screen until the plugin answers. A dialog with a[url],[copy]or[suggest]button behaves asclose, since the server never hears those being pressed.close: closes at once, then opens the next dialog, if any.none: stays as it is. End a button with[close]to leave the screen.
Typed values in commands#
A [console] or [player] command only takes a typed value (a text input, a
command's args:, values from /de open, {player_display}) when it is
letters, digits, _, . and -: a name, a number, an id. Anything else
(@a, a space, a quote) and the button runs nothing. A text input is drawn
again with the unsafe-value message, otherwise the player gets it in chat,
and the console names the placeholder. This is checked before the first action
runs, so a click never stops halfway.
When more than that is safe, say how the value is used:
| Filter | What it does |
|---|---|
{key|raw} | As typed, on one line. For the last, free-text argument of a plugin's command: staffchat {player}: {details|raw}. Not for vanilla's say, msg or tell, which read @a in it |
{key|json} | Escaped for the inside of a quoted JSON string: tellraw @a {"text":"{msg|json}"} |
{key|snbt} | Escaped for the inside of a quoted SNBT string: give {player} paper[custom_name='{name|snbt}'] |
Values from the dialog itself, from plugins and PlaceholderAPI, and from sliders, toggles and dropdowns (only options the dialog drew count) are not checked.
When a command fails#
If a [console] or [player] command fails, the actions after it do not run.
For [console] the player sees command-failed and the console logs it.
The server can only tell a command failed when it does not exist (its plugin is
missing) or throws an error. A command that ran and refused, like eco take
without the money, counts as a success. So check before taking anything, as
the shop above does with [if] %vault_eco_balance% >= {amount}.
Placeholders#
{name} works in titles, text, labels, tooltips, actions and conditions. A name
nothing knows is left as written. Values come from:
- what the dialog was opened with:
/de open shop Steve coins=40, an API call, a command'sargs:,defaults:, or an[open]or[set]action - everything typed into its inputs, once a button is pressed
- the built-ins below
- whatever a plugin registered, as
{prefix_key}(see For developers)
| Placeholder | Value |
|---|---|
{player} | The player's name (also {player_name}) |
{player_uuid} | Their UUID |
{player_display} | Their display name, as plain text |
{player_world} | The world they are in |
{player_x} {player_y} {player_z} | Their block position |
{player_health} | Their health, rounded up |
{player_level} | Their experience level |
{player_gamemode} | survival, creative, adventure or spectator |
{online} | Players online |
{max_players} | The server's player limit |
{dialog} | This dialog's id |
With PlaceholderAPI installed,
every %placeholder% works in the same places. A % in what a player typed is
never filled, so nobody can type a placeholder into a text box to read
somebody else's.
Choices. {mode?on:Enabled|off:Disabled|Unknown} prints the words for the
value mode has, or the last entry when none matches. A * entry matches any
value that is not empty ({nick?*:Has a nickname|None}). $value prints the
value itself:
- "<gray>Chat: {chat?true:<green>on|false:<red>off|$value}"Conditions#
if: works on a body entry, an input and a button. [if] is the same thing as
an action.
{muted} true unless empty, false, 0, no, off or null
!{muted}
{warnings} >= 3
{rank} == admin && perm:server.staff
({page} > 1 || {mode} != "quiet mode")==,!=,>,<,>=and<=compare. Two numbers compare as numbers, anything else as words, ignoring case.&&,||,!and brackets combine them.perm:nodeis whether the player has that permission.- A placeholder nothing could fill counts as false.
- Quote a value with spaces in it.
- A condition that cannot be read (a bracket never closed, two values with nothing between them) counts as false, and the console says why once.
A button's if: and permission: are checked again when it is pressed, so a
button that stopped applying after the dialog was drawn does nothing.
Lists and pages#
for-each: name on a body entry, a button or an input's options: repeats it
once per row of a list. Inside it:
{row.field}is a field of the row.as:renamesrow.{row.index},{row.first}and{row.last}say where in the list it is.per-page: Npages the list and sets{page},{pages},{has_next}and{has_prev}.[page] nextturns the page.limit: Ncaps how many rows are shown.
| Built-in list | Fields |
|---|---|
online_players | name, uuid, world, ping |
other_players | The same, without the player looking |
worlds | name, players, environment |
Vanished players stay hidden from whoever cannot see them. A dialog can declare
its own lists under lists:, and plugins can register more.
warps:
title: Warps
lists:
places:
- { id: spawn, name: "Spawn" }
- { id: arena, name: "<red>Arena" }
buttons:
- for-each: places
label: "{row.name}"
actions: ["[player] warp {row.id}", "[close]"]A paged list of players, eight to a page:
players:
title: "Online <dark_gray>({online})"
body:
- "<gray>Page {page} of {pages}"
buttons:
- for-each: online_players
per-page: 8
label: "{row.name}"
tooltip: "{row.world} · {row.ping}ms"
actions: ["[open] player_card target={row.name}"]
- label: "<gray>← Previous"
if: "{has_prev}"
actions: ["[page] prev"]
- label: "<gray>Next →"
if: "{has_next}"
actions: ["[page] next"]
exit:
label: "Close"Opening a dialog#
Its own command#
command: shop makes /shop open the dialog, and aliases: adds more names.
They come and go with /de reload, no restart needed. With a permission:, a
player without it is refused and does not see the command in tab completion. A
command name another plugin already has stays that plugin's, and the console
says so.
A dialog about somebody#
args: [target] makes /punish Steve open the dialog with {target} set to
Steve, and tab completion offers online players. The last argument takes the
rest of the line, so args: [target, reason] reads /punish Steve being rude
as Steve and being rude.
if-missing: opens another dialog when an argument is left out, usually a list
of players to pick from:
report:
command: report
args: [target]
if-missing: report_pick
title: "Report <red>{target}"
# ...
report_pick:
title: "Who are you reporting?"
buttons:
- for-each: other_players
label: "{row.name}"
actions: ["[open] report target={row.name}"]The Quick Actions key#
Minecraft 1.21.6 added a Quick Actions key, G unless a player rebinds it.
quick-action: true puts a dialog on it. With several dialogs on the key, G
shows a list of them to pick from.
menu:
title: "Menu for {player}"
quick-action: true # G opens the dialog itself
# ...
shop:
title: "Shop"
quick-action:
mode: launcher # G opens a button that opens the dialog fresh
label: "<gold>Shop" # what the key's list calls it (default: the title)
# ...The key is the player's game, not the server: pressing it opens a copy of the dialog the player was sent when they joined, and the server is never told. So there are two modes:
- direct (the default, also
true). G opens the dialog straight away. Dialog Engine draws each player's copy for them as they join, so{player}, a head, and PlaceholderAPI values (a LuckPerms rank, say) show what was true at that moment, and stay that way until they join again. Its buttons work as usual. The player is not in a world yet when it is drawn, so placeholders about where they are or their health are empty, and a button with apermission:is left out.DialogOpenEventis not fired: the server does not know it opened. - launcher. G opens a small screen with an Open button (its words are
messages.quick-openin config.yml), and the button has the server open the dialog, drawn fresh like any other: every check, placeholder and event as usual. One extra click, and nothing is out of date.
Direct needs Paper. On Spigot, and for a dialog with a permission: or a
json: dialog, G opens the launcher instead. A drawn dialog goes on the key
with quickAction: true in its dialog.yml (or the editor's Quick Actions
switch), and opens directly too; quickAction: launcher keeps the launcher, and a drawn dialog showing the player's own items always uses it.
While a drawn dialog is on the key, players are sent the drawn dialog pack as
they join, so it is ready before they first press G.
The key only picks up a change after a restart: what G opens is part of the
data the server reads as it starts, written to world/datapacks/dialogengine_quick,
and the console says when a restart is owed. Nothing extra is downloaded.
From the console, or for somebody else#
/de open <id> [player] [key=value ...]/de open samples:report Steve target=Alex opens the report on Steve's screen,
about Alex. Opening a dialog this way skips its own permission:; only
dialogengine.open (and dialogengine.open.others for another player) count.
The console and command blocks always name a player.
From another dialog, [open] id carries every value over, and [back] returns
to the first one as it was. The target dialog's permission: is still checked.
Raw JSON dialogs#
For something the game's dialog format can do and this YAML cannot,
json: file.json (a file beside the YAML) sends a minecraft:dialog object
exactly as written, with {placeholders} filled. Its buttons do whatever the
JSON says, and none of Dialog Engine's actions or checks apply to them.
Drawn dialogs#
A plain dialog uses the game's own widgets. A drawn dialog is a picture: a screen designed in Studio's dialog editor in the browser, in the game's look or any other, and shown with a small resource pack. Its buttons still run Dialog Engine's actions, and placeholders, PlaceholderAPI values and the player's own inventory are filled in as it is opened.
/de edit server:shop_drawnThat prints a link to the editor, which needs no account. The link works once
and lasts three hours. Draw the screen, press Send to server, and it is
written into plugins/DialogEngine/drawn/server/shop_drawn/ and loaded. Run
/de edit on it again to change it. You can also download a dialog from the
editor's Export menu for Dialog Engine, unzip it into plugins/ and run
/de reload.
/de editonly draws. A YAML dialog is edited in its file, and the command says so. A name without a namespace is inserver.- Each drawn dialog's folder has a
dialog.ymlwith itscommand:andcommandPermission:at the top. You can edit it by hand and/de reload: a changed file is sent to the editor to be redrawn, which needs the internet.
A command on a drawn dialog reads {name} from the same places its words do,
PlaceholderAPI included: {vault_eco_balance} is %vault_eco_balance%. On a
list, a row's command gets what that row showed when the dialog opened, so
party invite {player_list} invites the player whose name is on the row, even
if the list has changed since. That holds for every button a row can have
(Run command, Run as console, several commands) and however the list
is filled: by PlaceholderAPI, by a plugin, or when opening, as in
/de open server:warps Steve warps=Spawn,Shop. A list given when opening is
typed text, so an item goes into a command only when it is letters, digits,
_, . and -.
A drawn dialog's pieces fire DialogClickEvent too. A piece has no
id:, so name it in its command: in the editor, When clicked set to Run
command, with [event] claim. Your plugin then answers every piece of a menu
in one listener, and the event carries the player's settings with it. You can
also register an action and name it there, [myplugin:claim] daily (or
several, [a] ...; [b] ...). A command with no brackets is run by the player,
as on any dialog.
Settings#
A switch, slider, dropdown or segmented control in a drawn dialog can be bound
to a setting: a name like hud_quest_tracker. Each player has their own
value, kept on the player, so it is still there after they log out or the
server restarts. Clicking the control changes it and the dialog redraws.
- Inside the dialog,
{hud_quest_tracker}is the player's value. - Anywhere else, with PlaceholderAPI, it is
%dialogengine_setting_hud_quest_tracker%(see PlaceholderAPI). A scoreboard, a chat format or another plugin's config can read it there. - A plugin reads it with
setting(player, name).
Until a player clicks the control, the setting reads as the choice the dialog
shows first, so visible rather than nothing. A dialog drawn before Dialog
Engine 0.7.2 has no default saved: run /de edit on it and press Send to
server once to add it.
PlaceholderAPI#
With PlaceholderAPI installed, Dialog Engine answers these anywhere PlaceholderAPI is read:
| Placeholder | Value |
|---|---|
%dialogengine_setting_<name>% | The player's value for a drawn dialog's setting, or its default until they set it |
%dialogengine_var_<name>% | The same, spelled the way RP Engine spells it |
%dialogengine_open% | true when the player has a dialog open |
%dialogengine_dialog% | The id of the dialog they have open, or nothing |
%dialogengine_value_<key>% | A value of the dialog they have open, such as what they typed into an input |
%dialogengine_can_open_<id>% | true when they may open that dialog |
%dialogengine_dialogs% | How many dialogs are loaded |
%dialogengine_version% | The plugin's version |
A setting no dialog declares is printed as written, so a typo shows rather than reading as an empty value.
Dialog Engine does not need RP Engine for any of this. If you also run RP
Engine, the two keep their settings apart: a dialog Dialog Engine shows saves
to %dialogengine_setting_…%, and one RP Engine shows saves to
%rpengine_var_…%.
The same goes for Dialog Engine's own actions. Open another
dialog takes only an id, so to open one with values, set Run command to
[open] studio:shop item=diamond count={amount}. That is the [open] action:
the next dialog takes this one's place without closing it first, carries its
values over, and [back] returns. Running /de open from a button instead
closes the dialog and opens a new one, so the world flashes in between.
The resource pack#
All drawn dialogs share one small pack, which is sent alongside any pack your
server already sends, not instead of it. It is only built once you have a drawn
dialog (or a dialog with hide-button: true), so a server that
never uses either never asks anybody to download anything.
The plugin uploads the pack to ResourcePack AI's free pack host
(packs.resourcepack.ai) and players download it from there, so there is
nothing to open or set up (pack.host: upload). It is only uploaded again when
it changes, it is kept while your server uses it, and only the Minecraft client
can download it. If an upload fails, the plugin serves the pack itself until it
works.
To serve it yourself instead, set pack.host: serve: it is served on port
8165, and pack.public-host must be your server's public address or domain,
with that port open. Or host it somewhere else: /de pack writes it to a file,
and pack.url says where you put it.
Players with dialogengine.pack.notify are told the download address when the
pack fails to load for them.
Other plugins' shaders#
A drawn dialog that shows a player's head does it by replacing the game's text shader, and some HUD plugins (BetterHud among them) replace the same shader. A player's game keeps only one copy, from whichever pack is highest in their list, so without help one of the two stops drawing.
shaders:
merge: true
notify-players: trueWith merge: true, Dialog Engine reads the other plugin's pack from its folder
and combines the two shaders inside the drawn dialog pack, so both draw, with no
extra pack to download. When it has merged, a joining player's pack waits up to
three seconds for the other plugin's to arrive first, so the drawn pack lands on
top. If the other plugin's pack arrives later anyway, the drawn pack is sent
again, on top.
The console says what was merged, on which versions, and what could not be and
why. So does chat for players with dialogengine.shaders (ops), when it happens
and when they join; notify-players: false keeps it to the console.
Samples#
On first start the plugin writes sample dialogs into dialogs/samples/: a
welcome notice, server rules, a shop, kits, warps, a player list, a profile, a
report form, a settings page with every input type, and a menu of them all,
which /dialog-samples opens. Two more are drawn dialogs in drawn/samples/: a
punishment panel (/sample-punish <player>) and a six-page social settings menu
(/sample-social). Their pack is only sent when somebody opens one.
Only players with dialogengine.samples (ops) can open the samples. They are
yours to copy, change or delete. Deleting one file keeps it deleted; deleting
the whole folder brings them all back on the next start. samples: false in
config.yml stops them being written.
Commands#
/dialogengine, with /de and /dialogs as aliases. /de on its own lists
the subcommands you can use, and tab completion only offers those.
| Command | What it does | Permission |
|---|---|---|
/de list | Every dialog, by namespace, with its command | dialogengine.list |
/de open <id> [player] [key=value ...] | Open one, with values | dialogengine.open |
/de info <id> | What a dialog is made of: type, buttons, inputs, command, permission | dialogengine.info |
/de edit <id> | Draw one in the browser editor, or make a new one | dialogengine.edit |
/de pack | Write the drawn dialogs' resource pack to a file | dialogengine.pack |
/de reload | Read everything again and report what is wrong | dialogengine.reload |
/dialogclick is what a click on a drawn dialog runs. It only does what the
dialog on that player's screen allows, so it needs no permission and typing it
yourself does nothing.
Permissions#
Every node is op-only by default.
| Node | What it allows |
|---|---|
dialogengine.list | /de list |
dialogengine.open | /de open <id> on yourself, for any dialog, whatever its own permission: |
dialogengine.open.others | /de open <id> <player> on somebody else, on top of dialogengine.open |
dialogengine.info | /de info |
dialogengine.edit | /de edit. Pressing Send in the editor writes files into your server's dialog folder, so grant it with care |
dialogengine.pack | /de pack |
dialogengine.reload | /de reload |
dialogengine.pack.notify | Being told the drawn dialogs' pack address when it fails to load for you |
dialogengine.samples | Opening the sample dialogs |
dialogengine.update | Being told on joining that a newer Dialog Engine is out |
dialogengine.shaders | Being told when the drawn dialog pack's text shader was merged with another plugin's, or clashes with one |
dialogengine.admin | All of the above in one node |
A dialog's own permission: and a button's are whatever node you write there.
Give them out with your permissions plugin as usual:
/lp group default permission set myserver.shop true
/lp group admin permission set dialogengine.admin trueConfig#
plugins/DialogEngine/config.yml. /de reload reads it again.
| Key | Default | What it does |
|---|---|---|
samples | true | Write the sample dialogs when their folder is missing |
update-check | true | Say in the console and on join when an update is out |
telemetry | true | The anonymous usage count described under Installing |
click-lifetime-minutes | 30 | How long a dialog's buttons keep working after it is drawn. Drawing it again restarts the clock |
default-after | seamless | What a dialog does when a button is pressed, if it has no after:. See After a click |
close-delay-ticks | 10 | Under wait, how long the waiting screen is held for a plugin to answer before it closes |
click-sound | ui.button.click | The sound a click on a drawn dialog makes. Blank for none. A dialog drawn in Studio can set its own |
validation-format | <red>⚠ {error} | How a failed input check is shown when the dialog does not print {error} itself |
messages.* | Everything the plugin says to players, in MiniMessage | |
edit.url | https://studio.resourcepack.ai | Where the dialog editor is. Must be https:// |
pack.send | true | Send the drawn dialogs' pack to players as they join |
pack.required | false | Kick players who decline it |
pack.host | upload | upload to ResourcePack AI's pack host, or serve from this server |
pack.port | 8165 | The port the built-in pack server listens on (serve, or while an upload fails) |
pack.bind | blank | The address it listens on. Blank is every address |
pack.public-host | blank | The address players download it from: your server's public address or domain |
pack.url | blank | Host the pack yourself and put its URL here. The built-in server is then off |
pack.prompt | The line shown when the pack is offered |
How clicks are kept safe#
Every button is bound to the dialog the player was shown, with the values it was drawn with. Nothing a player types in chat presses a button.
- Only the latest drawing can be pressed. Opening another dialog, refreshing or a failed check retires the old buttons.
- A button's
permission:andif:are checked again when it is pressed. - Buttons stop working
click-lifetime-minutesafter the dialog was drawn, and a player gets at most ten clicks a second. - A drawn dialog's clicks work once per showing, only while it is on the
player's screen, and only run commands in its
dialog.yml.
For developers#
Add depend: [DialogEngine] to your plugin.yml (or softdepend, and check
DialogEngine.isEnabled() first) and compile against the jar. The API is in
ai.resourcepack.dialogs.api, and every call is main-thread only.
DialogEngineAPI dialogs = DialogEngine.api();
// Ship dialogs server owners can edit: copy defaults into your data folder,
// then register it. /de reload reads it again.
saveResource("dialogs/menu.yml", false);
dialogs.registerFolder(this, "myplugin", new File(getDataFolder(), "dialogs"));
// Open one, with values for its {placeholders}.
dialogs.open(player, "myplugin:menu", Map.of("coins", "120"));
dialogs.refresh(player); // draw the player's current dialog again
dialogs.close(player);
// Change what an open dialog says, then draw it once.
dialogs.set(player, "coins", "95");
dialogs.set(player, "status", "<green>Bought!");
dialogs.refresh(player);
// A new action: [myplugin:give] diamond 3
dialogs.registerAction(this, "myplugin:give", (ctx, arg) -> {
String[] p = arg.split(" ");
ctx.viewer().getInventory().addItem(new ItemStack(Material.matchMaterial(p[0]), Integer.parseInt(p[1])));
ctx.refresh();
});
// {myplugin_coins}
dialogs.registerPlaceholders(this, "myplugin_", (viewer, ctx, key) ->
key.equals("coins") ? String.valueOf(economy.balance(viewer)) : null);
// for-each: myplugin_quests
dialogs.registerList(this, "myplugin_quests", (viewer, ctx) -> quests.of(viewer).stream()
.map(q -> Map.of("id", q.id(), "name", dialogs.escape(q.name()), "done", String.valueOf(q.done())))
.toList());- Values you pass are read as MiniMessage. Put anything a player wrote
through
dialogs.escape(...)first. An action's argument arrives with its placeholders filled and typed text as typed, so check it before it goes into a command. registerDialog(plugin, "myplugin:x", section)registers a dialog built in code, as aConfigurationSectionin the same format.installDrawn(plugin, namespace)installs drawn dialogs your jar carries underdrawn/<namespace>/(listed in itsfiles.txt), once per version of your plugin. Any the server owner has edited are left alone.setting(player, name)reads what a drawn dialog's switch, slider or dropdown bound tonameis set to for that player. It is empty until they have set it;%dialogengine_setting_<name>%gives the dialog's default instead.setSetting(player, name, value)sets one, as if they had clicked the control, and a null value clears it back to the dialog's default. It fires noDialogSettingChangeEvent(that is for a player's own clicks) and draws nothing, sorefreshafterwards if they are looking at it. It returns false for a name or value a setting can't have. Since 0.8.1.set(player, key, value)changes one value of the dialog a player has open without drawing it, so several changes cost onerefresh. A null value takes the key away. It returns false when they have no dialog open. Since 0.8.1.- Also:
current(player),isOpen(player)andvalues(player)for the dialog a player has open,ids()andinfo(id)for what is loaded,canOpen(player, id),textJson(...)to render MiniMessage the way a dialog does,unregister(plugin)andreload().
Everything a plugin registers is dropped when it disables.
Your own items in a drawn dialog#
A drawn dialog's grid of item slots can show a container "from a plugin", by a name set in the editor: a bank, a shop's stock, a quiver. Register that name and Dialog Engine shows what your inventory holds, each item with its own picture, count and tooltip. If the grid lets items move, the player moves them between your container and their own inventory with two clicks.
dialogs.registerContainer(this, "bank", new DialogContainer() {
public Inventory inventory(Player viewer) { return banks.of(viewer); } // null: empty slots
public boolean mayPlace(Player viewer, int slot, ItemStack stack) {
return stack.getType() != Material.BEDROCK;
}
public void changed(Player viewer) { banks.save(viewer); }
});The inventory stays yours. It is read as the dialog opens and written as each
move happens, and a move reads both slots at that moment, so a stale screen
cannot duplicate an item. mayTake and mayPlace refuse a move per slot, and
DialogSlotMoveEvent still fires for every one, with the slot named
api.bank/0. Since 0.8.1.
Events#
| Event | When |
|---|---|
DialogOpenEvent | A dialog is about to be drawn: opened, refreshed, paged or returned to. Cancellable. getValues() can be changed, and isReopened() says whether it is the same dialog again |
DialogClickEvent | A button was pressed and its inputs passed, before its actions run. Cancellable. getButtonId(), getInputs() (what was typed, chosen and toggled), getSettings() (a drawn dialog's switches, sliders and dropdowns), getValues(), getActions() (changeable), isDrawn(), and getContext() to open, refresh or close |
DialogCloseEvent | A dialog left the player's screen. getReason() says how, getButtonId() which button closed it, getNextDialogId() what replaced it, and getValues() and getSettings() what it was left with. See below |
DialogSettingChangeEvent | A switch, slider or dropdown on a drawn dialog is about to change a setting. Cancellable: the setting keeps its old value. getName(), getOldValue(), getNewValue() |
DialogSlotMoveEvent | A stack is about to move between a drawn dialog's item slots. Cancellable: the items stay put. getFrom() and getTo() (inv/5, ender/3...), and copies of both stacks |
DialogInputErrorEvent | An input failed its check. The message can be changed |
DialogEngineReloadEvent | Everything was read again |
A button with an id: and no actions is one your plugin answers, and so is
any button whose actions name it with [event], which is how a drawn dialog's
pieces are named. One listener can run a whole menu:
@EventHandler
public void onClick(DialogClickEvent event) {
if (!event.getDialogId().equals("myplugin:menu")) return;
switch (event.getButtonId()) {
case "claim" -> rewards.claim(event.getPlayer());
case "save" -> profiles.save(event.getPlayer(), event.getInputs(), event.getSettings());
default -> { return; }
}
event.getContext().close();
}DialogCloseEvent fires once a dialog has gone, whatever took it away. Drawing
the same dialog again (a refresh, a page, a setting) is not a close. Its
reasons:
| Reason | |
|---|---|
EXIT | The exit button, or Escape, which presses it: exit:, a confirmation's cancel:, a drawn dialog's Close |
BUTTON | A button's actions closed it, or nothing came after them |
REPLACED | Another dialog took its place, after that one is on the screen |
SCREEN | A chest or other container, the death screen, or another world's loading screen took the screen |
PLUGIN | A plugin called close(player) |
QUIT | The player left |
The game tells the server about Escape only by pressing the exit button, so a
YAML dialog with buttons and no exit: closes with Escape unheard. Give it an
exit: (it needs no actions) when you need to know. On Folia, a move to
another world is not reported either: Folia does not tell plugins about it.
Support#
Questions, bugs and ideas: the ResourcePack AI Discord.