|
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. PlayersOnly(), PlayersAndServer() and ServerOnly() also register a console command (see Commands).
Definition at line 37 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.
Referenced by CommandManager(), and operator=().
|
default |
|
delete |
References CommandManager().
| 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::CommandDefinition::Access, and VoltMod::Chat.
| size_t VoltMod::CommandManager::Count | ( | ) | const |
Definition at line 148 of file CommandManager.cpp.
| bool VoltMod::CommandManager::HandleChatMessage | ( | Player * | caller, |
| std::string_view | message ) |
Run message when it is a ! command. Framework only.
Definition at line 103 of file CommandManager.cpp.
References VoltMod::CommandDefinition::Access, VoltMod::Chat, VoltMod::ServerOnly, VoltMod::Player::Slot(), 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 136 of file CommandManager.cpp.
References VoltMod::CommandSyntax::StripPrefix(), and VoltMod::CommandSyntax::Tokenize().
|
delete |
References CommandManager().
| void VoltMod::CommandManager::RemoveAll | ( | ) |
Remove every command. Framework only, on unload.
Definition at line 42 of file CommandManager.cpp.