QtCraft API C++ classes QML types Handbook

QcServerConfig Struct

The configuration of a game server: the world, its generation and storage, the streaming, operators, limits and the login of remote clients. More...

Header: #include <server/core/QcServerConfig.h>

Public Functions

void apply(const QcLoginSettings &login)

Public Variables

int autosaveSeconds
QString backupDirectory
int chunksPerTick
QList<QcPackFingerprint> contentPacks
std::optional<QcGameMode> defaultGameMode
bool fullAdminLog
QString generator
QString generatorOptions
int generatorVersion
bool keepChangedChunks
bool keepChunksLoaded
bool keepInventory
QcServerLimits limits
bool limitsFromServer
bool loadChunksAtOnce
int loginTimeoutMs
int maxPlayers
QString motd
QStringList operators
QString password
int pauseWhenEmptySeconds
qint64 seed
QString serverName
QString settingsFile
std::optional<std::array<int, 2>> spawnColumn
int viewDistance
QString worldDirectory
QString worldName
QJsonObject worldOptions

Detailed Description

Member Function Documentation

void QcServerConfig::apply(const QcLoginSettings &login)

Takes name, message of the day, password, player limit and content packs from login.

Member Variable Documentation

int QcServerConfig::autosaveSeconds

Seconds of the players' time between two autosaves; 0 never.

QString QcServerConfig::backupDirectory

Where /backup puts copies; empty: "backups" next to the folder of worlds.

int QcServerConfig::chunksPerTick

Upper bound of chunks sent per client and tick, keeps ticks short while a client catches up.

QList<QcPackFingerprint> QcServerConfig::contentPacks

The content packs a client must have (QcContentFingerprint, with hashes); empty: id and version of the packs of the loaded content.

std::optional<QcGameMode> QcServerConfig::defaultGameMode

Game mode of players who join for the first time (decision E-282): unset, the world's default (world.json) counts; set (server.json "defaultGameMode", an unsaved world) it wins, and a new world is created with it.

bool QcServerConfig::fullAdminLog

The admin channel shows operators the whole log of the process (a dedicated server); off, only the server's categories, since a world hosted by the game shares its log with the host's game (decision E-848).

int QcServerConfig::generatorVersion

The version of the world generator (decision E-922, QcWorldInfo::generatorVersion); a saved world must have been made with it, a new one keeps it.

bool QcServerConfig::keepChangedChunks

Test hook: only chunks whose blocks differ from the generated ones stay (the world before stage 31.3, for comparison runs against its dumps).

bool QcServerConfig::keepChunksLoaded

Test hook: no chunk leaves the world once loaded; for tests that build away from their player or look at the whole world without one.

bool QcServerConfig::keepInventory

Game rule for new and unsaved worlds; saved worlds keep the value in world.json.

bool QcServerConfig::loadChunksAtOnce

Test hook: chunks are read or generated at once when asked for, not in the background, so a run does not depend on how fast the threads are (comparison runs).

int QcServerConfig::loginTimeoutMs

A client that has not finished the login after this long is disconnected.

int QcServerConfig::maxPlayers

Players on the server at most, the local player included.

QString QcServerConfig::motd

The message of the day, shown in the login challenge.

QStringList QcServerConfig::operators

Operators besides the world's list (access.json) and the local player (decision E-244).

QString QcServerConfig::password

Empty: no password.

int QcServerConfig::pauseWhenEmptySeconds

The server stops ticking after no one was connected for this many seconds of the players' time, saving first, and resumes when someone connects (decision E-877); 0 never pauses. A dedicated server takes 60 from server.json; tests and worlds hosted in the game keep 0.

qint64 QcServerConfig::seed

The world seed of a new world.

QString QcServerConfig::serverName

The server's name, shown in the login challenge (login of remote clients, decision E-252).

QString QcServerConfig::settingsFile

The dedicated server's settings file (server.json): /limits writes changed limits into it (decision E-848); empty elsewhere.

std::optional<std::array<int, 2>> QcServerConfig::spawnColumn

Test hook: spawn above this block column (x, z) instead of the generator's spawn point.

int QcServerConfig::viewDistance

Radius in chunks streamed around each player; network clients may ask for less, never more.

QString QcServerConfig::worldDirectory

Directory of the saved world; empty runs without persistence (tests, throw-away worlds).

QString QcServerConfig::worldName

The world's name (QcWorldInfo::name of a new world).

QJsonObject QcServerConfig::worldOptions

The world generation options of the world (decision E-917, QcWorldInfo::worldOptions); a saved world must have been made with them. The generator and the server already run on content with them set (QcWorldOptions::apply).