10#include <unordered_map>
24 _router->Attach(&host);
36 InstallConsoleCommand(*added);
44 _consoleCommands.clear();
61 std::vector<std::string>
tokens;
62 tokens.reserve(
static_cast<size_t>(
args.ArgC()));
63 for (
int i = 1;
i <
args.ArgC(); ++
i)
86void CommandManager::ReplyToPlayer(
int slot,
const std::string&
line)
140 return !
parts.empty() && _router->IsForeign(
parts.front());
145 return _router->Count();
How a chat line is spelled: the prefix, and splitting one into tokens.
Fluent command registration, returned by CommandManager::Add.
CommandManager(Policy &policy, Translations &translations, PlayerManager &players, EntitySystem &entities, Messages &messages, IPluginContext &host)
bool HandleChatMessage(Player *caller, std::string_view message)
CommandBuilder Add(std::string_view name)
bool IsForeign(std::string_view message) const
The registered commands, their usage lines, and the dispatch that runs one.
runtime.Entities: finds and creates entities. Everything it returns is valid for this frame only; see...
Send chat, center print, center HTML, and alert messages.
void Send(int slot, std::string_view message, MessageKind kind=MessageKind::Chat)
The roster: every connected player, and the signals for the connection lifecycle.
One connected player, owned by PlayerManager for the length of the connection.
The one permission and targeting gate, plus the plugin's reply callback.
std::function< void(int slot, std::string_view message)> Reply
std::function< void(const CCommand &args, int slot)> Handler
static std::string ToLower(std::string_view str)
Localization system. Loads one JSON file per language; nested objects flatten into dotted keys (categ...
std::optional< std::string_view > StripPrefix(std::string_view message)
std::vector< std::string > Tokenize(std::string_view text)
void Info(std::format_string< Args... > fmt, Args &&... args)
static std::string ReadFile(const std::filesystem::path &path)
One command as the builder assembled it.