Skip to main content

Transfer the player

Before you begin, install the Cloud API, require the simplecloud-api platform plugin, and create one shared CloudApi client. Install simplecloud-api on every proxy that may handle the player because that proxy performs the transfer. Pass the registered server name, such as lobby-1, rather than the UUID returned by Server.getServerId(). Look up the player by UUID, confirm they are online, and connect them to the registered server name:
PlayerTransferService.java
Create one PlayerTransferService from your plugin’s shared CloudApi and logger. Call transferToLobby(...) from your command or matchmaking flow. The service returns PLAYER_NOT_FOUND when its lookup finds no online player. If the player disconnects after that check, connect(...) returns CONNECTION_FAILED.

Connection results

If your plugin needs to find an available destination first, see Route players with autoscaling.