Actions
Actions define what happens when a player clicks an element in a menu.
EasyMenu 7 allows you to freely combine simple command execution, message broadcasts, menu switching, sound effects, delays, and chat input prompts.
3 Step-by-Step Writing Styles
Choose the action format that fits your needs:
1. Simplest Format (command)
For running a single command or opening another menu, use a simple one-line command: property:
# Execute player command
command: "spawn"
# Open submenu
command: "sub_shop"
# Return to main menu
command: "main_mainopen"
2. Single Typed Action (action)
Explicitly declare a single action type (player command, console command, message, etc.):
action:
type: player-command
command: "spawn"
3. Multiple Typed Actions (actions)
Execute multiple actions sequentially from top to bottom (e.g. sending messages, playing sounds, and executing commands):
actions:
- type: message
message: "&aTeleporting to survival world..."
- type: sound
sound: BLOCK_NOTE_BLOCK_PLING
- type: player-command
command: "spawn"
What happens when styles are combined
| Combination | Result |
|---|---|
command together with action / actions | action / actions win. command is ignored and a warning (action-overrides-command) is logged. |
action together with actions | Error (ambiguous-action). The reload is rejected. |
| None of the three | Error: an item needs command, action or actions. Write actions: [] for a purely decorative item. |
Every entry in actions is invalid | Error (no-usable-action). This prevents a button from silently doing nothing. |
See the Diagnostic Codes page for what each code means.
Strict Sequential Execution Pipeline
In EasyMenu 7, actions defined in an actions list execute strictly in order, one by one.
If an action takes time (such as a delay, menu loading, or input prompt), it suspends asynchronously without freezing server threads, and automatically resumes when ready.
actions:
- type: message
message: "&eTeleporting in 3 seconds..."
- type: sound
sound: BLOCK_NOTE_BLOCK_HAT
- type: delay
duration: 3s # 3-second non-blocking delay
- type: player-command
command: "warp survival"
- type: message
message: "&aTeleported!"
If an action encounters a failure (such as a missing menu target, condition denial, or cancelled input), subsequent actions in the sequence are safely aborted.
Click Policy (click-policy)
Specify which mouse click triggers the element's actions:
menu-items:
- slot: 13
material: DIAMOND
click-policy: RIGHT # Triggers on right-click only
command: "shop buy"
| Value | Description |
|---|---|
PRIMARY (default) | Standard selection click (a left-click without Shift in a chest UI, or a button press in a Dialog or Bedrock form). |
LEFT | Left-click, including Shift + left-click. |
RIGHT | Right-click, including Shift + right-click. |
ANY | Every click type, including middle-click. |
Dialogs and Bedrock forms have no click types and always report PRIMARY, so an item with click-policy: RIGHT does not respond on those screens.