Custom Commands
Custom commands let you register an in-game command that runs a set of effects when a player types it. Each command has an ID, an alias players type, an optional permission, and the effects to run. This page covers creating one, naming it, its structure, and the argument tokens you can pass through to your effects.
Quick start
Open the
commands.ymlfile in/plugins/libreforge.Add a command under
commands:with anid, analias, and apermission.Add the effects to run under
effects:.Run
/libreforge reload.Type the alias in-game and confirm the effects run.
Naming and IDs
Every command needs an id, set in the command config. It is used in permissions and to tell commands apart. It is separate from the alias, which is what players actually type.
The structure of a command
| Part | What it controls |
|---|---|
| Command info | The ID, the alias players type, and the permission |
| Effects | What runs when the command is used |
| Arguments | Tokens in the alias passed through to the effects |
commands:
- id: "example_command" # === Command info ===
alias: "examplecmd <player> <value>" # What players type; <player> and <value> are arguments
permission: "libreforge.example_command" # Optional; the permission required to run the command
effects: # === Effects: what runs when the command is used ===
- id: give_money
args:
amount: "%value%" # %value% comes from the <value> argument in the alias
conditions:
- id: is_night
Command info
The id, alias, and permission identify the command and control who can run it.
id: "example_command" # The command ID, used in permissions and to tell commands apart
alias: "examplecmd <player> <value>" # What players type in-game to run the command
permission: "libreforge.example_command" # Optional; the permission required to run the command
Effects
These effects run when the command is used successfully. This is the core of the command: you can configure effects, conditions, filters, mutators, and triggers here, and even chains to string several effects together.
effects:
- id: give_money
args:
amount: "%value%"
conditions:
- id: is_night
Arguments
In the alias you can use argument tokens, which become placeholders in your effects. For example, <value> in the alias is available as %value% in the effects.
| Token | Meaning |
|---|---|
<player> | Required player argument |
<value> | Required value argument |
[value] | Optional value argument |
Inside these arguments you can use placeholders such as %player%, or %trigger_value% placeholders to pull information from a trigger when used with the run_command effect.
Where to go next
Effects: Configuring an Effect to build the effects your command runs.
Chains: Configuring an Effect Chain to group several effects under one command.
Placeholders: Custom Placeholders to reuse values in your command effects.