Mania++
 All Classes Functions Variables Pages
Public Member Functions | Private Attributes | List of all members
CommandManager Class Reference

Manages the chat commands. More...

#include <CommandManager.h>

Public Member Functions

 CommandManager (UIManager *uiManager, Methods *methodsPtr)
 Initializes the command-maps. More...
 
int RegisterCommands (std::string plugin, std::map< std::string, ChatCommand > methods)
 Registers the chat commands (from the plugins). More...
 
void RegisterCommand (ChatCommand command)
 Registers a chat command. More...
 
int RegisterAdminCommands (std::string plugin, std::map< std::string, ChatCommand > methods)
 Registers the admin chat commands (from the plugins). More...
 
void HandleCommand (Player player, std::string text)
 Handles chat commands (from PlayerChat callback). More...
 
void DisplayCommandList (Player player, bool admin=true)
 Displays the command list to the user. More...
 

Private Attributes

std::map< std::string,
ChatCommand
commands
 Map with normal chat commands.
 
std::map< std::string,
ChatCommand
adminCommands
 Map with admin chat commands.
 
UIManagerui
 Instance of the UI manager.
 
Methodsmethods
 

Detailed Description

Manages the chat commands.

Constructor & Destructor Documentation

CommandManager::CommandManager ( UIManager uiManager,
Methods methodsPtr 
)

Initializes the command-maps.

Parameters
uiManagerInstance of the UI manager.
methodsPtrInstance of the Methods.

Member Function Documentation

void CommandManager::DisplayCommandList ( Player  player,
bool  admin = true 
)

Displays the command list to the user.

Parameters
playerList requester.
adminShow admin commands or player commands?
void CommandManager::HandleCommand ( Player  player,
std::string  text 
)

Handles chat commands (from PlayerChat callback).

Parameters
playerAuthor of the command request.
textChat message.
int CommandManager::RegisterAdminCommands ( std::string  plugin,
std::map< std::string, ChatCommand methods 
)

Registers the admin chat commands (from the plugins).

Parameters
pluginName of the plugin the commands belong to.
methodsPlugin methods with admin command name.
void CommandManager::RegisterCommand ( ChatCommand  command)

Registers a chat command.

Parameters
commandChat command.
int CommandManager::RegisterCommands ( std::string  plugin,
std::map< std::string, ChatCommand methods 
)

Registers the chat commands (from the plugins).

Parameters
pluginName of the plugin the commands belong to.
methodsPlugin methods with command name.

The documentation for this class was generated from the following files: