|
VoltMod
C++23 framework for CS2 server plugins
|
Typed commands for chat and the server console. More...
#include <CommandManager.hpp>
Public Member Functions | |
| CommandManager (Policy &policy, Translations &translations, PlayerManager &players, EntitySystem &entities, Messages &messages, IPluginContext &host) | |
| ~CommandManager () | |
| CommandManager (const CommandManager &)=delete | |
| CommandManager & | operator= (const CommandManager &)=delete |
| CommandBuilder | Add (std::string_view name) |
| bool | HandleChatMessage (Player *caller, std::string_view message) |
| bool | IsForeign (std::string_view message) const |
| size_t | Count () const |
| void | RemoveAll () |
Typed commands for chat and the server console.
The handler's parameters are the argument spec; dispatch authorizes, binds and replies:
Commands live until the plugin unloads; the framework removes them before the plugin's state. Anywhere() and ServerOnly() also register a console command (see Commands).
Definition at line 36 of file CommandManager.hpp.
| VoltMod::CommandManager::CommandManager | ( | Policy & | policy, |
| Translations & | translations, | ||
| PlayerManager & | players, | ||
| EntitySystem & | entities, | ||
| Messages & | messages, | ||
| IPluginContext & | host | ||
| ) |
Every argument must outlive the manager. Command names are shared with the other plugins on host.
Definition at line 16 of file CommandManager.cpp.
|
default |
|
delete |
| CommandBuilder VoltMod::CommandManager::Add | ( | std::string_view | name | ) |
Start a command; .Run(handler) installs it.
Definition at line 29 of file CommandManager.cpp.
References VoltMod::Players, and VoltMod::ReadFile().
| size_t VoltMod::CommandManager::Count | ( | ) | const |
Definition at line 143 of file CommandManager.cpp.
Run message when it is a ! command. Framework only.
Definition at line 98 of file CommandManager.cpp.
References VoltMod::Chat, VoltMod::ReadFile(), VoltMod::ServerOnly, VoltMod::CommandSyntax::StripPrefix(), and VoltMod::CommandSyntax::Tokenize().
| bool VoltMod::CommandManager::IsForeign | ( | std::string_view | message | ) | const |
True when message is another plugin's command, which chat must pass on unfiltered.
Definition at line 131 of file CommandManager.cpp.
References VoltMod::ReadFile(), VoltMod::CommandSyntax::StripPrefix(), and VoltMod::CommandSyntax::Tokenize().
|
delete |
| void VoltMod::CommandManager::RemoveAll | ( | ) |
Remove every command. Framework only, on unload.
Definition at line 42 of file CommandManager.cpp.