servers

.servers() is used to get a list of all online servers

.servers()

Get a list of all online player servers with information.

Example:

// Dependencies
const CubedCraft = require('cubed-api');

// Getting the online servers
CubedCraft.API.servers().then(servers => {
    console.log(servers);
})

The results won't be in order of most players, to do that use the orderServers() function: https://pondwadermc.gitbook.io/cubed-api/documentation/utils/orderservers

Example Response:

{
    "server_count": 2,
    "total_players_online": 5,
    "servers": [
        {
            "id": "5ae66df8c3c245b395856ae52ec5d1c0",
            "name": "Raiding",
            "online": true,
            "maxPlayers": 100,
            "onlinePlayers": 0,
            "players": [],
            "boosters": 13,
            "plan_name": "Level-6",
            "plan_id": 7,
            "software": "spigot",
            "version": "1.8",
            "motd": "&4Faction Raid Server",
            "official": false,
            "started": 1611093605649,
            "visibility": true
        },
        {
            "id": "8c5035ff210542579532d60ebc3622b3",
            "name": "AetherWorld",
            "online": true,
            "maxPlayers": 15,
            "onlinePlayers": 3,
            "players": [
                "pxmegranate",
                "MidnightDragon9",
                "Sebgaming2008"
            ],
            "boosters": 0,
            "plan_name": "Free",
            "plan_id": 1,
            "software": "spigot",
            "version": "1.12",
            "motd": "&a90k chunks of nothing but air",
            "official": false,
            "started": 1611356844794,
            "visibility": true
        }
    ]
}

Last updated

Was this helpful?