Executing Commands
Learn how to run commands as the clicking player or as the server console (elevated privileges).
Running Player Commands
Commands are executed with the permissions of the player who clicked the item.
Shorthand Syntax
menu-items:
- slot: 11
material: COMPASS
name: "&aSpawn"
command: "/spawn" # Slashes are optional
Typed Action (type: player-command)
menu-items:
- slot: 11
material: COMPASS
name: "&aSpawn"
action:
type: player-command
command: "spawn"
Running Console Commands (type: console-command)
Commands are executed with full console privileges. Ideal for rewarding items (/give), updating balances (/eco give), or modifying permissions without granting operators status to players.
menu-items:
- slot: 13
material: GOLD_INGOT
name: "&6Claim Daily Reward"
action:
type: console-command
command: "eco give {player} 500"
Explicit Executor (
type: command)type: command allows explicitly setting the executor:
action:
type: command
executor: console # player (default) or console
command: "give {player} diamond 1"
Any executor other than player or console is rejected as an error.
Variables and Placeholders in Commands
Command strings support the variables below and PlaceholderAPI. Each variable is only available in specific places.
| Variable | Replacement | Where it works |
|---|---|---|
{player} | Player's Minecraft username | Every text template (commands, messages, names, lore, ...) |
{menu} | Current menu ID | Same as above |
{session} | Unique session identifier | Same as above |
{input} | Value collected by a type: input action (rename it with variable) | Only inside that action's command / actions (what runs after the value arrives) |
{input.<id>} | Value of an input declared in the menu's inputs and referenced by the item's input-refs | Inside that item's actions |
{remaining} | Seconds left on a cooldown | Only inside cooldown.message |
%<placeholder>% | Any PlaceholderAPI placeholder (e.g. %vault_eco_balance%) | Only when PlaceholderAPI is installed; otherwise left as plain text |
See PlaceholderAPI for how input values are handled.
Example
actions:
- type: console-command
command: "say &e{player} &fpurchased a VIP package!"
- type: console-command
command: "lp user {player} parent add vip"