Commands and placeholders
Set the console commands a product runs when a player pays, use placeholders like {player} and {uuid}, and pick the server they run on.
Commands are what make a purchase happen in the game. This page explains how to write them, which placeholders you can use and how to control where and when they run.
How commands run
Each product has a list of commands under Commands in its form. When an order is paid, the plugin on your server fetches them and runs them in the server console, one after the other, in the order you listed them.
- Type a command the way you would in the console. Leave out the slash. If you paste one with a slash, it is removed for you.
- One command per line. To run two commands, click Add command and put the second one on a new line.
- A product can have up to 20 commands, each up to 500 characters.
- Under each command, Runs as shows how it will look with an example player,
brickfox_.
A command runs once per product in the order, not once per item. If a player buys three crate keys, the command runs one time with {quantity} set to 3.
Placeholders
Placeholders are filled in with the details of the order. Click a placeholder under a command to insert it where your cursor is.
| Placeholder | Becomes | Example |
|---|---|---|
{player} |
The Minecraft name of the player | brickfox_ |
{uuid} |
The UUID of the player, with dashes | 069a79f4-44e9-4726-a5be-fca90e38aaf5 |
{quantity} |
How many the player bought | 3 |
{price} |
The price paid for one | 9.99 |
{order} |
The order number | 1042 |
{price} is the price after a sale, before any coupon. Any other word in braces is refused when you save, with a list of the placeholders that do exist. That way a typo like {playr} never reaches your server.
Which server
Once you have linked a server, each command has a select next to it:
- All servers runs the command once on every active server.
- Only followed by a server name runs it on that server alone.
A command you add before linking any server runs on all servers. If no server is linked yet when an order is paid, the command waits. The first server you link picks it up, so nothing a player paid for is lost. See Multiple servers and Install the plugin.
Wait until the player is online
Some commands only work while the player is in the game, like giving items to their inventory. Tick Wait until the player is online on such a command. It then waits until the player is on that server and runs as soon as they are.
Leave it off for commands that work on offline players, like most LuckPerms commands. Those run right after payment.
Examples
A permanent rank with LuckPerms
lp user {player} parent add vip
parent add adds the group and keeps the other groups the player has. Avoid parent set for ranks you sell: it removes all other groups first.
An upgrade from VIP to MVP
lp user {player} parent remove vip
lp user {player} parent add mvp
Both run in order, so the player ends up with MVP only.
A rank for 30 days
Make the product timed instead of using a temporary LuckPerms command. Set a duration of 30 days, use lp user {player} parent add vip as the purchase command and lp user {player} parent remove vip as the expiry command. See Ranks and items for a period.
Crate keys
crate key give {player} vote {quantity}
The exact command depends on your crate plugin. With {quantity}, one purchase of five keys gives five keys in a single command.
Items
give {player} diamond {quantity}
Tick Wait until the player is online here: the player must be in the game to receive items.
A message in chat
say Thank you {player} for buying VIP!
Test a command
Paste the command in your server console with your own name in place of {player}. If it works there, it works from your store. If a delivery fails, see Delivery problems.
Editing a product later
The commands are filled in and saved with the order the moment it is paid. Changing a product's commands later does not change what runs for orders already paid. You can follow each command on the order page. See Deliveries.
Still stuck? Mail us at hello@minecraftstore.io and a person answers.