Real-world script examples to get you started. Each one demonstrates a different use case. You can copy them, change the id values to match your setup, and they should work.
All scripts go in plugins/commandbridge/scripts/ on Velocity.
Broadcast a maintenance warning to all your backend servers from the proxy. This is probably the most common use case for CB.
version: 4
name: alert
description: Broadcast an alert to all servers
enabled: true
aliases: []
permissions:
enabled: true
silent: false
register:
- id: "proxy-1"
location: VELOCITY
defaults:
run-as: CONSOLE
execute:
- id: "lobby"
location: BACKEND
- id: "survival"
location: BACKEND
- id: "minigames"
location: BACKEND
server:
target-required: false
schedule-online: false
player-arg: ""
delay: 0s
cooldown: 0s
args:
- name: message
required: true
type: GREEDY_STRING
suggestions: []
commands:
- command: "say [Alert]: ${message}"
What happens:
/alert on the Velocity proxysay [Alert]: <message> is sent to the console on all three backendsGREEDY_STRING so the message can contain spaces without quotingPermission: commandbridge.command.alert
Send the player to the lobby server. This is registered on a backend so players can run /lobby while playing on survival (or any other game mode).
version: 4
name: lobby
description: Send the player to the lobby
enabled: true
aliases: [hub]
permissions:
enabled: true
silent: false
register:
- id: "survival-1"
location: BACKEND
defaults:
run-as: PLAYER
execute:
- id: "proxy-1"
location: VELOCITY
server:
target-required: false
schedule-online: false
player-arg: ""
delay: 0s
cooldown: 0s
args: []
commands:
- command: "server lobby"
What happens:
/lobby (and /hub) on the backend survival-1server lobby is forwarded to Velocity and executed as the playerlobby serverKey detail: run-as: PLAYER is required here because server lobby needs to run in the player's context on Velocity. If you used CONSOLE, it would try to send the console to lobby, which obviously doesn't work.
Permission: commandbridge.command.lobby
This technique can be used to bridge Velocity-only commands to your backend servers. In this case, the /server lobby command would exist as a native backend command, allowing plugins on that server to execute it and, for example, send players to the lobby.
Give money to a player. Demonstrates using argument types like PLAYERS and INTEGER for proper tab completion and input validation.
version: 4
name: eco-give
description: Give money to a player on a backend
enabled: true
aliases: [eco]
permissions:
enabled: true
silent: false
register:
- id: "proxy-1"
location: VELOCITY
defaults:
run-as: CONSOLE
execute:
- id: "survival-1"
location: BACKEND
server:
target-required: false
schedule-online: false
player-arg: ""
delay: 0s
cooldown: 0s
args:
- name: player
required: true
type: PLAYERS
suggestions: []
- name: amount
required: true
type: INTEGER
suggestions: []
commands:
- command: "eco give ${player} ${amount}"
What happens:
/eco-give (and /eco) on proxy-1PLAYERS gives tab completion for online playersINTEGER only accepts whole numbers, so a player can't type random text herePermission: commandbridge.command.eco-give
Ban a player across the network. This shows how to run multiple commands in one script and override execution targets per command. A common pattern for network-wide moderation.
version: 4
name: netban
description: Ban a player on all servers
enabled: true
aliases: [nban]
permissions:
enabled: true
silent: false
register:
- id: "proxy-1"
location: VELOCITY
defaults:
run-as: CONSOLE
execute:
- id: "survival-1"
location: BACKEND
- id: "lobby-1"
location: BACKEND
server:
target-required: false
schedule-online: false
player-arg: ""
delay: 0s
cooldown: 0s
args:
- name: target
required: true
type: PLAYERS
suggestions: []
- name: reason
required: false
type: GREEDY_STRING
suggestions: []
commands:
- command: "ban ${target} ${reason}"
- command: "say ${target} has been banned: ${reason}"
execute:
- id: "admin-1"
location: BACKEND
run-as: CONSOLE
What happens:
/netban Steve cheating is run on Velocityban Steve cheating runs on survival-1 and lobby consoles (uses the defaults)say Steve has been banned: cheating runs on the Admin backend console (overrides execute to target only one backend instead of all backends)Permission: commandbridge.command.netban
Give a target player a reward 30 seconds after the command is run. If that target player is offline, the command is queued and executes when they come back.
version: 4
name: claim-reward
description: Claim your daily reward
enabled: true
aliases: [reward]
permissions:
enabled: true
silent: false
register:
- id: "proxy-1"
location: VELOCITY
defaults:
run-as: CONSOLE
execute:
- id: "survival-1"
location: BACKEND
server:
target-required: false
schedule-online: true
player-arg: "player"
delay: 0s
cooldown: 24h
args:
- name: player
required: true
type: OFFLINE_PLAYER
suggestions: []
commands:
- command: "say ${player} is claiming their daily reward..."
- command: "give ${player} diamond 5"
delay: 30s
What happens:
/claim-reward <player> on Velocitycooldown: 24h prevents them from using it again for 24 hours (cooldowns are not persisted across restarts)Permission: commandbridge.command.claim-reward