How to Make a Dialog
Dialogs are real client GUI screens, using the same native system vanilla uses for server links. Each dialog is one config with a title, body text, and buttons that run commands. This page covers making a dialog and the ways to open one.
Quick start
Open
/plugins/EcoItems/dialogs/.Copy
_example_dialog.ymland rename it to your dialog's ID, e.g.kit_picker.yml.Set the
titleandbody.Add
buttonswith thecommandsorconsole-commandseach one runs.Run
/ecoitems reload.Open it with
/ecoitems dialog kit_pickerto confirm it works.
Naming and IDs
The file name without .yml is the dialog's ID, used in /ecoitems dialog <id>.
The structure of a dialog
| Part | What it controls |
|---|---|
| Text | The title and body lines |
| Closing | Whether escape closes the screen |
| Buttons | The action buttons and the commands they run |
# === Text: title and body ===
title: "&6Choose a Kit"
body: # Lines of body text
- "&fWelcome to the server."
- "&7Pick a kit to get started."
# === Closing ===
can-close-with-escape: true # Defaults to true
# === Buttons: what players can click ===
buttons: # Optional; without any, the dialog is a notice with an OK button
- label: "&aWarrior"
tooltip: "&7Sword and shield" # Optional
commands: # Run as the player
- "kit warrior"
- label: "&bArcher"
console-commands: # Run from the console
- "give %player% bow"
Text
title and each body line support the full color and glyph pipeline.
Closing
can-close-with-escape controls whether pressing escape closes the dialog. It defaults to true.
Buttons
Each button has a label, an optional tooltip, and the commands it runs: commands run as the player, and console-commands run from the console. %player% is replaced in every command. Without buttons:, the dialog is a simple notice with an OK button, which suits rules screens and announcements.
Opening a dialog
Command:
/ecoitems dialog <id> [player](permissionecoitems.command.dialog).Command blocks and any plugin that can run commands.
Effects: a furniture or block effect running
ecoitems dialog <id> %player%through libreforge's command effect.
Where to go next
Furniture: How to Make Furniture to open a dialog when players interact with a placed object.
Commands: Commands and Permissions for the
/ecoitems dialogcommand.