Example: Lobby
Send a player to the lobby server using a command registered on a backend.
Script
Place this script on Velocity (plugins/commandbridge/scripts/lobby.yml). The register block tells CommandBridge to register the command on the backend remotely:
version: 2
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
timeout: 5s
delay: 0s
cooldown: 0s
args: []
commands:
- command: "server lobby"
What happens
- Registers
/lobby(and alias/hub) on the backend serversurvival-1 - When a player runs it, the command
server lobbyis forwarded to Velocity and executed as the player - The player is transferred to the
lobbyserver
Permissions
Set commandbridge.command.lobby on the backend (where the command is registered).
lp user playerName permission set commandbridge.command.lobby true
run-as: PLAYER is required here because server lobby needs to run in the player's context on Velocity.