Skip to main content

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​

CombinationResult
command together with action / actionsaction / actions win. command is ignored and a warning (action-overrides-command) is logged.
action together with actionsError (ambiguous-action). The reload is rejected.
None of the threeError: an item needs command, action or actions. Write actions: [] for a purely decorative item.
Every entry in actions is invalidError (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.

Action sequence with delay
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!"
Fail-Stop Safety

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"
ValueDescription
PRIMARY (default)Standard selection click (a left-click without Shift in a chest UI, or a button press in a Dialog or Bedrock form).
LEFTLeft-click, including Shift + left-click.
RIGHTRight-click, including Shift + right-click.
ANYEvery 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.


Detailed Guides & Action Reference​