Example: Economy
Give money to a player on a backend server. Demonstrates typed arguments with backend-only argument types.
Script
Place this in plugins/commandbridge/scripts/eco-give.yml on Velocity:
version: 2
name: eco-give
description: Give money to a player on a backend
enabled: true
aliases: [eco]
permissions:
enabled: true
silent: false
register:
- id: "survival-1"
location: BACKEND
defaults:
run-as: CONSOLE
execute:
- id: "survival-1"
location: BACKEND
server:
target-required: false
schedule-online: false
timeout: 5s
delay: 0s
cooldown: 0s
args:
- name: player
required: true
type: PLAYERS
- name: amount
required: true
type: INTEGER
commands:
- command: "eco give ${player} ${amount}"
What happens
- Registers
/eco-give(alias/eco) on the backendsurvival-1 playeruses thePLAYERStype. Tab-completes online players and supports selectors like@a.amountusesINTEGER. Accepts whole numbers.- The resolved command runs on
survival-1's console
Test it
/eco-give Steve 500
Runs eco give Steve 500 on the survival-1 server console.
Permissions
Set the permission on the backend where the command is registered:
lp user playerName permission set commandbridge.command.eco-give true
PLAYERS is a backend-only argument type. It can only be used in scripts that register on a BACKEND. See Argument Types for platform availability.