// Initialize the API
CloudApi api = CloudApi.create();
// Get all servers in a group
api.server().getServersByGroup("lobby").thenAccept(servers -> {
System.out.println("Lobby servers: " + servers.size());
});
// Start a new server
api.server().startServer(new StartServerRequest("group-id", "lobby"))
.thenAccept(server -> System.out.println("Started: " + server.getServerId()));
// Send a message to a player (Adventure integration)
api.player().get(playerUUID).thenAccept(player -> {
if (player != null) {
player.sendMessage(Component.text("Welcome!").color(NamedTextColor.GREEN));
}
});
// Subscribe to server events
Subscription sub = api.event().server().onStarted(event -> {
System.out.println("Server started: " + event.getServerId());
});