QtCraft API C++ classes QML types Handbook

QcCommandSpec Struct

A command as the registry knows it (decision E-243). More...

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

Public Variables

QStringList aliases
QcCommandCategory category
const char *description
qsizetype minArguments
QString name
std::function<QStringList ()> names
const char *namesLine
bool needsPlayer
QcPermission permission
QcCommandHandler run
const char *usage

Detailed Description

usage and description are English texts marked with QT_TRANSLATE_NOOP("QcServerMessages", ...); /help shows them translated. Every field has an initializer, so designated initializers may leave any out.

Member Variable Documentation

QStringList QcCommandSpec::aliases

Other names that run the command.

QcCommandCategory QcCommandSpec::category

The group /help lists it under (decision E-911).

const char *QcCommandSpec::description

What the command does, one sentence.

qsizetype QcCommandSpec::minArguments

Fewer words after the name answer with the usage.

QString QcCommandSpec::name

The command's name.

bool QcCommandSpec::needsPlayer

Runs only for players (it acts on the player or around him); the console gets a refusal.

QcPermission QcCommandSpec::permission

The right the command needs.

QcCommandHandler QcCommandSpec::run

What runs the command.

const char *QcCommandSpec::usage

The usage line ("Usage: /name <placeholder> [optional]").