Moving players between sub-servers
How a mini-script moves players between the sub-servers of your server.
A server can have sub-servers: for example, a main server as the lobby and game servers that only its players reach. A mini-script with uses subservers moves players between them. It needs your consent. For scripts, see Sub-servers.
Send players
On the lobby, /play sends the player to the sub-server called "Game", with a hint:
uses subservers, message
command /play
permission everyone
move to subserver "Game" with "team=red"
end
on move failed
message "The game cannot take you now ({reason})"
endmove to subserver "Game"moves the block's player. Use the name shown in the panel; case does not matter.move players() to subserver "Game"moves several players together, all or none.move to mainmoves to the main server.- A name that no sub-server has stops the block, and the error shows under While running.
- The move is requested and the block goes on. If it is refused,
on move failedruns for each player, and the player stays.
Receive players
On the game server, on arrive runs once per move, after on join:
uses subservers, message
on arrive
message "Welcome from {from_server}"
if data = "team=red"
message "You play for red"
end
endfrom_serveris the server the player came from.datais the text afterwith, or none. It is at most 3 KiB.
Treat data as a hint only. Do not trust it for anything worth money or rights.
Why a move fails
reason is one of no_permission, no_place, unknown_server, not_running, full, offline, bedrock, other_protocol, not_admitted, too_much_data, busy and no_answer. The common ones:
not_running: the target server is not running.full: the target has no room for all of the players.unknown_server: the target is not another server of your group.offline: a player left during the move.bedrock: a Bedrock player who cannot be moved.other_protocol: a Java player on a different Minecraft version than the server.busy: a move of this player is under way, or your mini-scripts ask for too many moves. See Limits.no_answer: Play Strawberry did not confirm the move. Nobody is moved.