Skip to main content

Inputs

EasyMenu 7 includes an Inputs system that collects values (text, numbers, booleans, dropdown options) from players when opening menus or clicking buttons.

In Native Dialogs, inputs render as interactive UI components (text fields, number sliders, switches). In Inventory GUIs, inputs seamlessly fall back to chat prompts.


Basic Form Input Example​

Collect a purchase quantity from the player before executing the shop command:

# Menu-level input definitions
inputs:
- id: count
type: integer
label: "Enter quantity (1–64)"
min: 1
max: 64
initial: 1

menu-items:
- id: buy_diamond
slot: 13
material: DIAMOND
name: "&bBuy Diamonds"
input-refs:
- count # References the input defined above
command: "shop buy diamond {input.count}"

Input Types (type)​

TypeDescriptionKey Configuration Properties
textFree-form text stringmax-length, initial
integerWhole integer numbermin, max, max-length, initial
decimalDecimal numbermin, max, max-length, initial
booleanToggle switch / true/falseinitial
optionChoice from defined optionsoptions, initial

Keys shared by every input:

KeyDefaultDescription
idRequiredIdentifier referenced as {input.<id>}. A duplicate within one menu is an error (duplicate-input-id).
typetextOne of the types above. An unknown type is an error (invalid-input).
labelThe id valueHeading shown to the player.
timeout-secondsinput.default-timeout-seconds in config.yml (default: 60)Seconds to wait for chat input. 0 or less is an error.

These are also errors: min greater than max, an option input with no options, duplicate option ids, and an item input-refs entry that names an undeclared input. Writing min / max on a text / boolean / option input, or options on a non-option input, only logs a warning.

Not the same as the type: input action

The inputs described here is the menu-wide input form, referenced through an item's input-refs. The type: input action inside an item's actions is a separate mechanism that collects one value through chat only. It supports string / integer / decimal and the value is referenced as {input} (or the name set with variable). See Advanced Actions.


Option List Input (type: option)​

inputs:
- id: rank_duration
type: option
label: "Select VIP Duration"
options:
- id: "1d"
display: "1 Day ($100)"
- id: "7d"
display: "7 Days ($500)"
- id: "30d"
display: "30 Days ($1,500)"
initial: "7d"

menu-items:
- slot: 13
material: NETHER_STAR
name: "&6Purchase VIP"
input-refs:
- rank_duration
command: "rank buy vip {input.rank_duration}"

Cross-Backend Validation Parity​

Input values submitted via graphical dialog widgets and values entered through chat prompts are validated against the exact same rules (InputContract):

  • Initial Value Validation: Initial values (initial) are verified at reload time to ensure they satisfy the input requirements.
  • Length Limits: text, integer, and decimal reject input longer than max-length (default 128). Numeric inputs also check the length of the canonical plain representation before expanding exponential notation.
  • Injection Safety: Collected values are safely injected into {input.<id>} with all formatting codes sanitized.

When a player types cancel during a chat prompt, the input is aborted and the item's remaining actions are not run.