QtCraft API C++ classes QML types Handbook

QcCommandArguments Namespace

Parsing of command words shared by the commands. More...

Header: #include <server/commands/QcCommandArguments.h>

Variables

const double lowestTeleportY

Functions

std::optional<int> blockCoordinate(const QString &word, std::optional<int> origin)
std::optional<QcBlockPos> blockPosition(const QStringList &words, qsizetype first, std::optional<QcBlockPos> origin)
std::optional<int> count(const QStringList &words, qsizetype index, int fallback, int low, int high)
QList<QcServerClient *> players(const QcServerState &state, const QString &name)
std::optional<QcVec3> point(const QStringList &words, qsizetype first, std::optional<QcVec3> origin)
QString qualified(const QString &name)
std::optional<bool> toggle(const QString &word)

Detailed Description

Everything a command reads is checked here or by the command before it changes anything.

Variable Documentation

const double QcCommandArguments::lowestTeleportY

Lowest height a teleport accepts: down into the void, where a player dies (decision E-288).

Function Documentation

std::optional<int> QcCommandArguments::blockCoordinate(const QString &word, std::optional<int> origin)

Returns the block coordinate word within [lowestBlock, highestBlock]: a whole number, or with origin also "~" and "~<n>" relative to it; std::nullopt for anything else, however large.

std::optional<QcBlockPos> QcCommandArguments::blockPosition(const QStringList &words, qsizetype first, std::optional<QcBlockPos> origin)

Returns the three block coordinates in words starting at index first, relative to origin where they use "~"; std::nullopt when one is invalid, missing or outside [lowestBlock, highestBlock] (the caller checks the height).

std::optional<int> QcCommandArguments::count(const QStringList &words, qsizetype index, int fallback, int low, int high)

Returns the whole number at index of words within [low, high], or fallback when the word is missing; std::nullopt for anything else.

QList<QcServerClient *> QcCommandArguments::players(const QcServerState &state, const QString &name)

Returns the joined players of state whose name matches name (cleaned, without case); usually one, more after duplicate names (decision E-232).

std::optional<QcVec3> QcCommandArguments::point(const QStringList &words, qsizetype first, std::optional<QcVec3> origin)

Returns the point for teleporting in words starting at index first: finite numbers, "~" relative to origin, x and z within the body range (QcWorld::lowestBody, QcWorld::highestBody) and y from lowestTeleportY to the top of the world; std::nullopt when one is invalid or missing.

QString QcCommandArguments::qualified(const QString &name)

Returns name with a namespace: names without one mean the base game's ("qtcraft:").

std::optional<bool> QcCommandArguments::toggle(const QString &word)

Returns word read as "true|on" or "false|off"; std::nullopt for anything else.