Mania++
 All Classes Functions Variables Pages
CommandManager.h
1 #ifndef COMMANDMANAGER_H_
2 #define COMMANDMANAGER_H_
3 
4 #include <string>
5 #include <map>
6 #include <functional>
7 
8 #include "ChatCommand.h"
9 #include "../Methods/Methods.h"
10 #include "../Objects/Player.h"
11 #include "../UI/UIManager.h"
12 
13 //* CommandManager
18 {
19 public:
26  CommandManager(UIManager* uiManager, Methods* methodsPtr);
27 
34  int RegisterCommands(std::string plugin, std::map<std::string, ChatCommand> methods);
35 
41  void RegisterCommand(ChatCommand command);
42 
49  int RegisterAdminCommands(std::string plugin, std::map<std::string, ChatCommand> methods);
50 
57  void HandleCommand(Player player, std::string text);
58 
65  void DisplayCommandList(Player player, bool admin = true);
66 
67 private:
68  std::map<std::string, ChatCommand> commands;
69  std::map<std::string, ChatCommand> adminCommands;
72  Methods* methods;
73 };
74 
75 #endif // COMMANDMANAGER_H_
void HandleCommand(Player player, std::string text)
Handles chat commands (from PlayerChat callback).
Definition: CommandManager.cpp:89
CommandManager(UIManager *uiManager, Methods *methodsPtr)
Initializes the command-maps.
Definition: CommandManager.cpp:3
int RegisterCommands(std::string plugin, std::map< std::string, ChatCommand > methods)
Registers the chat commands (from the plugins).
Definition: CommandManager.cpp:25
void DisplayCommandList(Player player, bool admin=true)
Displays the command list to the user.
Definition: CommandsUI.cpp:3
Manages the user interface on the server (ManiaLinks).
Definition: UIManager.h:17
int RegisterAdminCommands(std::string plugin, std::map< std::string, ChatCommand > methods)
Registers the admin chat commands (from the plugins).
Definition: CommandManager.cpp:70
Contains all information about a player in easy-to-use format.
Definition: Player.h:11
UIManager * ui
Instance of the UI manager.
Definition: CommandManager.h:71
Contains all server methods and returns usable data types.
Definition: Methods.h:15
Stuct containing information about a chat command.
Definition: ChatCommand.h:11
std::map< std::string, ChatCommand > commands
Map with normal chat commands.
Definition: CommandManager.h:68
void RegisterCommand(ChatCommand command)
Registers a chat command.
Definition: CommandManager.cpp:44
std::map< std::string, ChatCommand > adminCommands
Map with admin chat commands.
Definition: CommandManager.h:69
Manages the chat commands.
Definition: CommandManager.h:17