console_command
console_command runs one or more commands after a player triggers your custom command.
This is the most flexible command type in the plugin because it lets you chain actions and decide:
- who executes each command
- where each command runs
Required fields
type: "console_command"
command: /send [playerName:player]
enabled: true
to-run:
1:
executes-on: player
runs-on: backend
command: /ban %playerName%to-run layout
Each numbered entry under to-run is one command step.
to-run:
1:
executes-on: player
runs-on: backend
command: /server survival
2:
executes-on: console
runs-on: velocity
command: alert %player_name% was movedEach step must contain:
executes-onruns-oncommand
Valid values
executes-on
The code accepts:
playerconsole
runs-on
The code accepts:
velocitybackend
What each combination means
player + velocity
The plugin runs the command as the player through Velocity’s command manager.
player + backend
The plugin sends the command to the backend by spoofing player chat input.
This is how backend-executed player commands are handled.
console + velocity
The plugin runs the command as the Velocity console.
console + backend
This is not supported by the implementation.
If you configure this, the player is shown an error message explaining that console commands may only run on the proxy.
Example: send a player to another backend
commands:
hub:
type: "console_command"
command: /hub
enabled: true
to-run:
1:
executes-on: player
runs-on: velocity
command: server hubExample: run multiple steps
commands:
staffjoin:
type: "console_command"
command: /staffjoin [server:word]
permission: "velocitycommands.staffjoin"
enabled: true
to-run:
1:
executes-on: player
runs-on: velocity
command: server %server%
2:
executes-on: console
runs-on: velocity
command: say %player_name% joined %server%Placeholders in command
You can use both:
- parameter placeholders such as
%server% - built-in placeholders such as
%player_name%
The plugin replaces your configured parameters first, then applies its built-in placeholders.
Notes
This command type still assumes a player triggered it
The execution logic casts the source to a player, so it is designed around player-triggered commands.
Multiple numbered entries are processed in order
The plugin reads the sections under to-run and adds them to its internal list in that order.
The class constructor has a minor internal type mismatch
Internally, the command subclass passes the wrong enum to its parent constructor, but this does not change the actual runtime behaviour described here because loading is based on the original command type before the subclass executes.