Actions
Actions are commands executed when a player interacts with a button. zMenu provides 28+ action types for various purposes.
Basic Usage
items:
my-button:
slot: 0
item:
material: DIAMOND
actions:
- type: message
messages:
- "&aHello, %player%!"
- type: sound
sound: UI_BUTTON_CLICK
Common Options
All actions support the following optional parameters:
delay
Add a delay (in ticks) before the action is executed. 20 ticks = 1 second.
actions:
- type: refresh
delay: 10 # Wait 10 ticks before refreshing
chance
Set a percentage chance for the action to execute. Combined with deny-chance-actions to define fallback actions when the chance fails.
actions:
- type: console-command
commands:
- "give %player% diamond 1"
chance: 50 # 50% chance to execute
deny-chance-actions: # Actions to execute if chance fails
- type: message
messages:
- "&cNo luck this time!"
Options:
| Option | Type | Description |
|---|---|---|
delay | Integer | Delay in ticks before execution (20 ticks = 1 second) |
chance | Integer | Percentage chance (0-100) for the action to execute |
deny-chance-actions | List | Actions to execute if the chance check fails |
Example with both options:
actions:
- type: refresh
delay: 20 # Wait 1 second
chance: 75 # 75% chance
deny-chance-actions:
- type: message
messages:
- "&cThe refresh failed!"
Message Actions
- message
- messages (Alias)
- type: message
messages:
- "&aLine 1"
- "&bLine 2"
minimessage: true # Optional: Use MiniMessage format default: true
- type: messages
messages:
- "&aMultiple lines"
- "&bOf text"
message-to
Send a message to a specific player.
- type: message-to
target-player: "Notch"
messages:
- "&aHello from %player%!"
broadcast
Send a message to all online players.
- type: broadcast
messages:
- "&6[Announcement] &f%player% purchased a special item!"
minimessage: true # Optional: Use MiniMessage format (default: true)
action-bar
Display an action bar message.
- action
- actionbar (Alias)
- type: action
message: "&aWelcome to the shop!"
- type: actionbar
message: "&aWelcome to the shop!"
title
Display a title and subtitle.
- type: title
title: "&6&lWelcome!"
subtitle: "&7Enjoy your stay"
start: 20 # Ticks
duration: 60 # Ticks
end: 20 # Ticks
change-title
Change the inventory title.
This action is only available when the PacketEvents plugin is installed on your server. Without it, the action is simply not registered and will silently do nothing.
- change-title
- change-title-name (Alias)
- type: change-title
inventory-name: "My New Inventory Title"
- type: change-title-name
inventory-name: "My New Inventory Title"
Options:
| Option | Type | Required | Description |
|---|---|---|---|
inventory-name | String | Yes | The new inventory title to display |
Available aliases: change-title, change-title-name.
toast
Display a toast notification (achievement popup).
- toast
- send-toast (Alias)
- type: "toast"
material: DIAMOND # Material for the toast icon (default: PAPER)
message: "&aAchievement Unlocked!"
toast-type: CHALLENGE # TASK, GOAL, or CHALLENGE (default: CHALLENGE)
model-id: "0" # Optional: custom model data
glowing: false # Optional: glowing effect (default: false)
- type: "send toast"
material: DIAMOND
message: "&aAchievement Unlocked!"
toast-type: CHALLENGE # TASK, GOAL, or CHALLENGE (default: CHALLENGE)
Options:
| Option | Type | Default | Description |
|---|---|---|---|
material | String | PAPER | Material for the toast icon |
message | String | Default message | The toast notification text |
toast-type | String | CHALLENGE | Toast frame style: TASK, GOAL, or CHALLENGE |
model-id | String | 0 | Custom model data for the icon item |
glowing | Boolean | false | Whether the icon item has a glowing effect |
Sound Actions
sound
Play a sound to the player.
- type: sound
sound: ENTITY_EXPERIENCE_ORB_PICKUP
pitch: 1.0 # 0.5 to 2.0
volume: 1.0 # Distance
sound-category: MASTER # Optional sound category
Common Sounds:
UI_BUTTON_CLICKENTITY_EXPERIENCE_ORB_PICKUPENTITY_PLAYER_LEVELUPENTITY_VILLAGER_YESENTITY_VILLAGER_NOBLOCK_NOTE_BLOCK_PLINGBLOCK_CHEST_OPENBLOCK_CHEST_CLOSE
View the complete list of available sounds in the Bukkit Sound JavaDocs.
broadcast-sound
Play a sound to all online players.
- broadcast_sound
- broadcast sound
- type: broadcast_sound
sound: ENTITY_ENDER_DRAGON_DEATH
pitch: 1.0
volume: 1.0
sound-category: MASTER # Optional
- type: "broadcast sound"
sound: ENTITY_ENDER_DRAGON_DEATH
pitch: 1.0
volume: 1.0
sound-category: MASTER # Optional
Command Actions
player-command
Execute a command as the player.
- player-command
- player command (Alias)
- type: player-command
commands:
- "spawn"
- "kit starter"
command-in-chat: false # Optional: execute via chat instead of dispatch (default: false)
- type: "player command"
commands:
- "spawn"
- "kit starter"
command-in-chat: false # Optional: execute via chat instead of dispatch (default: false)
Options:
| Option | Type | Required | Description |
|---|---|---|---|
commands | List | Yes | List of commands to execute |
command-in-chat | Boolean | No | Execute via chat instead of dispatch (default: false) |
Note: This action supports multiple aliases for flexibility.
Available aliases: player-command, player_command, player_commands, player command, player commands, player-commands.
player-command-as-op
Execute a command as the player with OP permissions.
- player-commands-as-op
- player command as op (Alias)
- type: player-command-as-op
commands:
- "gamemode creative"
- type: "player command as op"
commands:
- "gamemode creative"
Options:
| Option | Type | Required | Description |
|---|---|---|---|
commands | List | Yes | Commands to execute as OP |
Note: Remember to enable this action in your configuration.
Available aliases: player-command-as-op, player commands as op, player command as op, player_commands_as_op, and player_command_as_op.
Use with caution! This gives the player temporary OP-level access.
You need to enable it in the configuration file:
enable-player-commands-as-op-action: true
console-command
Execute a command from the console.
- console-command
- console command (Alias)
- type: console-command
commands:
- "give %player% diamond 64"
- "eco give %player% 1000"
- type: "console command"
commands:
- "give %player% diamond 64"
- "eco give %player% 1000"
Options:
| Option | Type | Required | Description |
|---|---|---|---|
commands | List | Yes | Commands to execute as the console user |
Note: Supports flexible aliasing for varied command syntax.
Available aliases: console-command, console-commands, commands, command, console command, console commands, console_commands and console_command.
chat
Force the player to send a chat message.
- type: chat
messages:
- "Hello everyone!"
Options:
| Option | Type | Required | Description |
|---|---|---|---|
messages | List | Yes | The list of messages for the player to send |
random-player-command
This action requires zMenu+.
Execute a random selection of commands as the player from a list. The commands are selected without replacement (no duplicates in a single execution).
- type: random_player_command
commands:
- "say I got option 1!"
- "say I got option 2!"
- "say I got option 3!"
- "say I got option 4!"
amount: 1 # Number of commands to randomly execute (default: 1)
command-in-chat: false # Optional: execute via chat instead of dispatch (default: false)
Options:
| Option | Type | Default | Description |
|---|---|---|---|
commands | List | Required | List of commands to randomly select from |
amount | Integer | 1 | Number of random commands to execute |
command-in-chat | Boolean | false | If true, sends via player.chat(); if false, dispatches as command |
Aliases: random_player_command, random_player_commands, random-player-command, random-player-commands
random-console-command
This action requires zMenu+.
Execute a random selection of console commands from a list. The commands are selected without replacement (no duplicates in a single execution). Supports the %player% placeholder.
- type: random_console_command
commands:
- "give %player% diamond 1"
- "give %player% emerald 1"
- "give %player% gold_ingot 1"
- "give %player% iron_ingot 1"
amount: 2 # Execute 2 random commands from the list
Options:
| Option | Type | Default | Description |
|---|---|---|---|
commands | List | Required | List of console commands to randomly select from |
amount | Integer | 1 | Number of random commands to execute |
Aliases: random_console_command, random_console_commands, random-console-command, random-console-commands, random-command, random-commands
Inventory Actions
inventory
Open another inventory.
- type: inventory
inventory: "shop"
page: 1 # Optional: specific page
arguments: # Optional: pass arguments
- "arg1"
close
Close the current inventory.
- type: close
back
Go back to the previous inventory.
- type: back
refresh
Refresh the current button.
- type: refresh
refresh-inventory
Refresh the entire inventory (redraw all buttons).
- refresh-inventory
- refresh inventory (Alias)
- type: refresh-inventory
- type: "refresh inventory"
Options:
| Option | Type | Required | Description |
|---|---|---|---|
| None | N/A | N/A | No additional parameters. |
Note: Used to redraw all inventory buttons.
Available aliases: refresh-inventory, refresh inventory and ri.
Player Actions
teleport
Teleport the player to coordinates.
- teleport
- tp (Alias)
- type: teleport
world: "world"
x: 0
y: 100
z: 0
yaw: 0 # Optional
pitch: 0 # Optional
- type: tp
world: "world"
x: 0
y: 100
z: 0
yaw: 0 # Optional
pitch: 0 # Optional
connect
Connect the player to another server (BungeeCord/Velocity).
- type: connect
server: "lobby"
Data Actions
data
Modify player data values.
- type: data
action: SET # SET, ADD, SUBTRACT, MULTIPLY, DIVIDE, REMOVE
key: "coins"
value: "100"
math: true # Optional: enable math expressions
Options:
| Option | Type | Description |
|---|---|---|
action | String | The operation to perform (see table below) |
key | String | The player data key to operate on |
value | String | The value to use (supports placeholders) |
math | Boolean | Enable math expression evaluation in value (default: false) |
seconds | Long | If set, store the value for only this many seconds before it expires |
Actions:
| Action | Description | Example |
|---|---|---|
SET | Set to specific value | value: "100" |
ADD | Add to current value | value: "50" |
SUBTRACT | Subtract from current | value: "25" |
MULTIPLY | Multiply current value | value: "2" |
DIVIDE | Divide current value | value: "2" |
REMOVE | Remove the key entirely | - |
Math expressions:
- type: data
action: ADD
key: "total"
value: "%zmenu_player_value_base%*1.5"
math: true
Temporary data (expires after N seconds):
- type: data
action: SET
key: "cooldown"
value: "1"
seconds: 86400 # Expires after 24 hours
Economy Actions
deposit
Add money to player's balance.
- deposit
- money add (Alias)
- type: deposit
currency: "vault" # Optional: specify currency plugin
#economy: # When a economy plugin allows multiple currencies, you can specify which one to use.
amount: 50
reason: "Purchase" # Optional
- type: "money add"
currency: "vault" # Optional: specify currency plugin
#economy: # When a economy plugin allows multiple currencies, you can specify which one to use.
amount: 50
reason: "Purchase" # Optional
See the full list of supported currencies here.
withdraw
Remove money from player's balance.
- withdraw
- money remove (Alias)
- type: withdraw
currency: "vault" # Optional: specify currency plugin
#economy: # When a economy plugin allows multiple currencies, you can specify which one to use.
amount: 50
reason: "Purchase" # Optional
- type: "money remove"
currency: "vault" # Optional: specify currency plugin
#economy: # When a economy plugin allows multiple currencies, you can specify which one to use.
amount: 50
reason: "Purchase" # Optional
See the full list of supported currencies here.
Book Action
book
Open a written book for the player.
- type: book
author: "Server"
title: "&6Welcome Book"
lines:
1:
- "&6Welcome!"
- "&7This is page 1"
- "of our welcome book."
2:
- "&6Page 2"
- "&7More content here."
Dialog Action
dialog
Open a dialog popup. Dialogs provide a modern UI experience with forms, confirmations, and interactive buttons.
Dialogs require Paper 1.21.7+ installed on your server.
- type: dialog
dialog: "confirmation"
With arguments:
- type: dialog
dialog: "purchase-confirm"
arguments:
- "diamond_sword"
- "500"
From external plugin:
- type: dialog
dialog: "custom-dialog"
plugin: "MyPlugin"
Options:
| Option | Type | Description |
|---|---|---|
dialog | String | Name of the dialog file (without .yml) |
plugin | String | Plugin name if using external dialog |
arguments | List | Arguments to pass to the dialog |
See Dialogues for complete dialog configuration documentation.
Bedrock Action
bedrock
Open a native Bedrock form for players connected via Geyser/Floodgate.
Bedrock forms require Geyser or Floodgate installed on your server.
- type: bedrock
bedrock: "simple-form"
With arguments:
- type: bedrock
bedrock: "feedback-form"
arguments:
- "arg1"
- "arg2"
From external plugin:
- type: bedrock
bedrock: "custom-form"
plugin: "MyPlugin"
Options:
| Option | Type | Description |
|---|---|---|
bedrock | String | Name of the Bedrock form file (without .yml) |
plugin | String | Plugin name if using external form |
arguments | List | Arguments to pass to the form |
See Bedrock Forms for complete Bedrock form configuration documentation.
Discord Actions
discord
Send a message to a Discord webhook.
- discord
- send discord (Alias)
- type: discord
webhook: "https://discord.com/api/webhooks/..."
message: "%player% made a purchase!"
username: "Shop Bot" # Optional
avatar: "https://..." # Optional
embeds:
- title: "New Purchase"
description: "%player% bought an item"
color: "#00FF00"
url: "https://example.com/purchase"
footer:
text: "Powered by zMenu"
icon-url: "https://example.com/icon.png"
thumbnail:
url: "https://example.com/thumbnail.png"
image:
url: "https://example.com/image.png"
author:
name: "zMenu Bot"
url: "https://example.com/bot"
icon-url: "https://example.com/bot-icon.png"
fields:
- name: "Item"
value: "Diamond Sword"
inline: true
- name: "Price"
value: "$500"
inline: true
- type: "send discord"
webhook: "https://discord.com/api/webhooks/..."
message: "%player% made a purchase!"
username: "Shop Bot" # Optional
avatar: "https://..." # Optional
Options:
| Option | Type | Required | Description |
|---|---|---|---|
webhook | String | Yes | Webhook URL for the Discord server. |
message | String | No | Plain text message to send. |
username | String | No | Override the webhook's display name. |
avatar | URL | No | Override the webhook's avatar URL. |
embeds | List | No | Discord embed objects. |
Available aliases: discord, send discord, discord webhook, discordwebhook.
discord_component
Send a Discord message with buttons/components.
- discord_component
- Discord Component V2 (Aliases)
- type: discord_component
webhook: "https://discord.com/api/webhooks/..."
component:
- title: "New Purchase"
description: "%player% bought an item"
color: "#00FF00"
- type: "discord component"
webhook: "https://discord.com/api/webhooks/..."
component:
- title: "New Purchase"
description: "%player% bought an item"
color: "#00FF00"
Available aliases: discord_component, discord component, discord webhook component, discordwebhookcomponent.
Integration Actions
luckperm-set
Modify LuckPerms permissions.
- permission-set
- permission set (Alias)
- set permission (Alias)
- set-permission (Alias)
- type: permission-set
permission: "server.vip"
value: true # Grant (true) or revoke (false), default: true
expiration: -1 # Seconds until expiry; -1 = permanent
time-unit: SECONDS # Optional: SECONDS, MINUTES, HOURS, DAYS
- type: "permission set"
permission: "server.vip"
value: true
- type: "set permission"
permission: "server.vip"
value: false # Revoke the permission
- type: set-permission
permission: "server.vip"
value: true
expiration: 2592000 # 30 days in seconds
Options:
| Option | Type | Default | Description |
|---|---|---|---|
permission | String | — | The LuckPerms permission node to grant or revoke |
value | Boolean | true | true to grant, false to revoke |
expiration | Long | -1 | Duration before the permission expires; -1 = permanent |
time-unit | String | SECONDS | Unit for expiration: SECONDS, MINUTES, HOURS, DAYS |
Available aliases: permission-set, permission set, set permission, set-permission.
shopkeeper
Interact with Shopkeepers plugin.
- type: shopkeeper
name: "shop_name"
Item Actions
These actions give or take items directly from the menu or the player's inventory. They are perfect for shops, kits or reward systems.
set_item
Place an item in one or several slots, either in the menu or in the player's inventory.
- set_item
- set-item (Alias)
- type: set_item
slot: 13 # or slots: [13, 14, 15]
in-player-inventory: false # false = menu (default), true = player inventory
dupe-protection: true # default: true
item:
material: DIAMOND
name: "&bReward"
- type: set-item
slot: 13
item:
material: DIAMOND
name: "&bReward"
Options:
| Option | Type | Default | Description |
|---|---|---|---|
slot | Integer | - | The slot to set (use slots for several slots) |
slots | List | - | The list of slots to set |
in-player-inventory | Boolean | false | Place the item in the player's inventory instead of the menu |
dupe-protection | Boolean | true | Protect the placed item against duplication |
item | Item | - | The item to place (can also be defined inline at the action level) |
Available aliases: set_item, set-item.
take_item
Remove a number of matching items from the player's inventory.
- take_item
- take-item (Alias)
- type: take_item
amount: 1
verification: SIMILAR # SIMILAR (default) or MODELID
use-cache: false # default: false
item:
material: DIAMOND
- type: take-item
amount: 5
item:
material: DIAMOND
Options:
| Option | Type | Default | Description |
|---|---|---|---|
amount | Integer | 1 | Number of items to remove from the player |
verification | String | SIMILAR | How items are matched: SIMILAR or MODELID (custom model data) |
use-cache | Boolean | false | Use the cached item stack when building the target item |
item | Item | - | The item to match and remove (can also be defined inline) |
Available aliases: take_item, take-item.
item_give
Give an item directly to the player's inventory. If the inventory is full, leftover items are dropped at the player's location.
- type: item_give
item:
material: DIAMOND
name: "&bFree Diamond"
amount: 1
Options:
| Option | Type | Required | Description |
|---|---|---|---|
item | Item | Yes | The item to give (supports all item configuration options) |
Available aliases: item_give, item-give.
item_edit
Replace or modify an item at a specific slot in the player's inventory.
- type: item_edit
slot: "5"
item:
material: DIAMOND_SWORD
name: "&6Upgraded Sword"
Options:
| Option | Type | Required | Description |
|---|---|---|---|
slot | String | Yes | The inventory slot to edit |
item | Item | Yes | The replacement item |
Available aliases: item_edit, item-edit.
reset-pagination
Reset the pagination state for one or more pagination context IDs, or for all contexts.
# Reset specific context(s)
- type: reset-pagination
type: context
context-id: "my_list" # single context
# context-ids: ["list1", "list2"] # or multiple
# Reset all contexts for this player
- type: reset-pagination
type: all
Options:
| Option | Type | Default | Description |
|---|---|---|---|
type | String | context | Reset mode: context (specific IDs) or all (every context) |
context-id | String | — | Single pagination context ID to reset (type: context only) |
context-ids | List | — | Multiple pagination context IDs to reset |
Available aliases: reset-pagination.
refresh_slot
Refresh only the given slot(s) without redrawing the whole inventory.
- refresh_slot
- refresh-slot (Alias)
- type: refresh_slot
slots: [13, 14, 15]
in-player-inventory: false # default: false
- type: refresh-slot
slots: [13]
Options:
| Option | Type | Default | Description |
|---|---|---|---|
slots | List | - | The list of slots to refresh |
in-player-inventory | Boolean | false | Refresh slots in the player's inventory instead of menu |
Available aliases: refresh_slot, refresh-slot.
Complete Examples
Purchase with Feedback
items:
buy-item:
slot: 13
item:
material: DIAMOND_SWORD
name: "&6&lDiamond Sword"
lore:
- "&7Price: &a$500"
click-requirement:
purchase:
requirements:
- type: placeholder
placeholder: "%vault_eco_balance%"
action: SUPERIOR_OR_EQUAL
value: 500
deny:
- type: message
messages:
- "&cYou need $500!"
- type: sound
sound: ENTITY_VILLAGER_NO
success:
- type: withdraw
amount: 500
- type: console-command
commands:
- "give %player% diamond_sword 1"
- type: message
messages:
- "&aPurchase successful!"
- type: sound
sound: ENTITY_PLAYER_LEVELUP
- type: close
Toggle Setting with Data
items:
toggle:
slot: 22
type: SWITCH
placeholder: "%zmenu_player_value_setting%"
buttons:
"on":
item:
material: LIME_DYE
name: "&a&lSetting: ON"
actions:
- type: data
action: SET
key: "setting"
value: "off"
- type: message
messages:
- "&7Setting turned &cOFF"
- type: sound
sound: UI_BUTTON_CLICK
- type: refresh
"off":
item:
material: GRAY_DYE
name: "&7&lSetting: OFF"
actions:
- type: data
action: SET
key: "setting"
value: "on"
- type: message
messages:
- "&7Setting turned &aON"
- type: sound
sound: UI_BUTTON_CLICK
- type: refresh
Multi-Action Button
items:
reward:
slot: 13
item:
material: CHEST
name: "&e&lDaily Reward"
actions:
- type: console-command
commands:
- "give %player% diamond 5"
- type: deposit
amount: 1000
- type: data
action: SET
key: "last_reward"
value: "%zmenu_time_unix_timestamp%"
- type: title
title: "&6&lReward Claimed!"
subtitle: "&75 Diamonds + $1000"
- type: sound
sound: ENTITY_PLAYER_LEVELUP
- type: broadcast
messages:
- "&6%player% &7claimed their daily reward!"
- type: close
Action Order
Actions execute in the order they're listed. If you need to close the inventory after a teleport, put close before teleport:
actions:
- type: close
- type: teleport
world: "world"
x: 0
y: 100
z: 0
Using Actions in Requirements
Actions can also be used in deny and success blocks of requirements:
click-requirement:
vip-check:
requirements:
- type: permission
permission: "server.vip"
deny:
- type: message
messages:
- "&cYou need VIP!"
success:
- type: message
messages:
- "&aAccess granted!"
Quick Reference Table
Common Options (all actions)
| Option | Description |
|---|---|
delay | Delay in ticks before execution |
chance | Percentage chance to execute |
deny-chance-actions | Fallback actions if chance fails |
Action Types
| Action | Description |
|---|---|
message | Send message to player |
broadcast | Send message to all |
action-bar | Show action bar |
title | Show title/subtitle |
toast | Show achievement toast |
sound | Play sound |
player-command | Run command as player |
console-command | Run command as console |
random-player-command | Run random command(s) as player (zMenu+) |
random-console-command | Run random console command(s) (zMenu+) |
inventory | Open inventory |
close | Close inventory |
back | Go back |
refresh | Refresh the current button's appearance |
teleport | Teleport player |
connect | Change server (BungeeCord/Velocity integration) |
data | Modify player data |
deposit | Add money |
withdraw | Remove money |
broadcast_sound | Play sound to all players |
message-to | Send message to specific player |
change-title | Change the inventory title |
refresh-inventory | Refresh entire inventory |
book | Open a written book |
dialog | Open dialog popup |
discord | Send a message to Discord |
discord_component | Send Discord message with buttons |
permission-set | Modify LuckPerms permissions |
shopkeeper | Interact with Shopkeepers plugin |
set_item | Place an item in menu/player slot(s) |
take_item | Remove matching items from the player |
refresh_slot | Refresh specific slot(s) only |
item_give | Give an item to the player's inventory |
item_edit | Replace item at a specific slot |
reset-pagination | Reset pagination context(s) for the player |
Next Steps
- Learn about Player Data for storing values
- See Requirements for conditional actions
- Create Patterns with default actions