QcServerSettings Struct
The settings of a dedicated server (decision E-255), kept in server.json in the data directory (or a file given with –server-config) and overridden by command line options: name, message of the day, port and bind address, player limit, password, world, view distance limit and the connection limits. More...
| Header: | #include <server/network/QcServerSettings.h> |
Public Functions
| QcResult<QHostAddress> | address() const |
| QcNetworkConfig | networkConfig() const |
| int | newWorldGeneratorVersion() const |
| QcServerConfig | serverConfig() const |
| QJsonObject | toJson() const |
| QcStatus | write(const QString &target) const |
Public Variables
| QString | bindAddress |
| int | connectionBurst |
| double | connectionsPerSecond |
| std::optional<QcGameMode> | defaultGameMode |
| int | generatorVersion |
| QStringList | limitWarnings |
| QcServerLimits | limits |
| int | loginTimeoutSeconds |
| int | maxConnectionsPerAddress |
| int | maxPlayers |
| QString | motd |
| QStringList | operators |
| QString | password |
| QString | path |
| int | pauseWhenEmptySeconds |
| quint16 | port |
| std::optional<qint64> | seed |
| QString | serverName |
| int | viewDistance |
| QString | world |
| QString | worldOptions |
| QString | worldType |
Static Public Members
| const QStringView | fileName |
| const int | formatVersion |
| QcResult<QcServerSettings> | fromJson(const QJsonObject &json) |
| const int | maxPauseWhenEmptySeconds |
| const int | maxPlayersLimit |
| const int | maxViewDistance |
| const qsizetype | maxWorldOptionsLength |
| QcResult<QcServerSettings> | read(const QString &path) |
Detailed Description
Unknown keys are kept out; wrong values are refused with the key's name.
Member Function Documentation
QcResult<QHostAddress> QcServerSettings::address() const
Returns the listener's address: the bind address, or Any.
[static] QcResult<QcServerSettings> QcServerSettings::fromJson(const QJsonObject &json)
Returns the settings read from json (keys missing: defaults), or the first wrong value by its key.
QcNetworkConfig QcServerSettings::networkConfig() const
Returns the values of the listener: address, port and connection limits (open connections in all: the larger of maxPlayers + 16 and twice maxPlayers).
int QcServerSettings::newWorldGeneratorVersion() const
Returns the generator version a new world gets: generatorVersion, or the current one for 0.
[static] QcResult<QcServerSettings> QcServerSettings::read(const QString &path)
Reads the settings file path; a missing file gives the defaults. Returns the settings or the first wrong value.
QcServerConfig QcServerSettings::serverConfig() const
Returns the values that concern the game server and the listener (the world comes from elsewhere).
QJsonObject QcServerSettings::toJson() const
Returns the settings as the file's JSON, with every key.
QcStatus QcServerSettings::write(const QString &target) const
Writes the file target (with every key, so it documents itself); returns an error when it cannot.
Member Variable Documentation
QString QcServerSettings::bindAddress
Empty: IPv4 and IPv6 on every interface.
int QcServerSettings::connectionBurst
New connections an address may open at once (the bucket's size).
double QcServerSettings::connectionsPerSecond
New connections per second and address in the long run (token bucket, decision E-254).
std::optional<QcGameMode> QcServerSettings::defaultGameMode
Game mode of players who join for the first time ("survival", "creative"; empty in the file: the world's default). A world the server creates gets it as its default (decision E-282).
const QStringView QcServerSettings::fileName
The name of the settings file in the data directory.
const int QcServerSettings::formatVersion
The format written into the file ("format").
int QcServerSettings::generatorVersion
The world generator version of a world the server creates (decision E-922); 0, the default: the current one. A saved world keeps its own.
int QcServerSettings::loginTimeoutSeconds
Seconds a connection may take to log in (1 to 600).
int QcServerSettings::maxConnectionsPerAddress
Open connections per address at most.
const int QcServerSettings::maxPauseWhenEmptySeconds
The longest pause when empty (one day).
int QcServerSettings::maxPlayers
Players at most (1 to maxPlayersLimit).
const int QcServerSettings::maxPlayersLimit
The highest player limit.
const int QcServerSettings::maxViewDistance
The highest view distance limit in chunks.
const qsizetype QcServerSettings::maxWorldOptionsLength
The longest world generation options accepted.
QString QcServerSettings::motd
The message of the day.
QStringList QcServerSettings::operators
Operators besides the world's access.json (by name; bound to the identity at their login).
QString QcServerSettings::password
The password players must give; empty: none.
QString QcServerSettings::path
The file read() read (or would have read); not written into it. /limits writes changed limits there (QcServerConfig::settingsFile, decision E-848).
int QcServerSettings::pauseWhenEmptySeconds
Seconds without anyone connected before the server stops ticking (decision E-877); 0 never.
quint16 QcServerSettings::port
The TCP port to listen on (0: a free one).
QString QcServerSettings::serverName
The server's name, sent to clients when they log in.
int QcServerSettings::viewDistance
The view distance limit in chunks (1 to maxViewDistance).