src/modernnet/helpers

Source   Edit  

Types

PlayerSample = object
  name*: string
  id*: UUID
Used for creating the server list sample Source   Edit  

Procs

func buildServerListJson(versionName: string;
                         versionProtocol, maxPlayers, onlinePlayers: int;
                         sample: seq[PlayerSample] = newSeq(0);
                         description: string = ""; ext: JsonNode = nil): JsonNode {.
    ...raises: [MnInvalidJsonError], tags: [RootEffect], forbids: [].}

Creates a status JSON response for Java Edition servers.

The description field is a Chat object, but is not currently handled as such.

The ext field is an optional field used for passing other fields not specified, such as modinfo for Forge clients.

Example:

import modernnet

let sample = @[PlayerSample(name: "VeryRealPlayer",
  id: "7f81c9a5-4aae-4ace-abd2-1586392441de".parseUUID())]

let serverList = buildServerListJson("1.19.4", 762, 100,
  sample.len, sample, "Much wow")

echo $serverList
Source   Edit