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 "../Objects/Player.h"
9 
10 //* CommandManager
15 {
16 public:
21 
27  int RegisterCommands(std::map<std::string, std::function<void(Player, std::vector<std::string>)>> methods);
28 
34  int RegisterAdminCommands(std::map<std::string, std::function<void(Player, std::vector<std::string>)>> methods);
35 
42  void HandleCommand(Player player, std::string text);
43 
44 private:
45  std::map<std::string, std::function<void(Player, std::vector<std::string>)>> commands;
46  std::map<std::string, std::function<void(Player, std::vector<std::string>)>> adminCommands;
47 };
48 
49 #endif // COMMANDMANAGER_H_
void HandleCommand(Player player, std::string text)
Handles chat commands (from PlayerChat callback).
Definition: CommandManager.cpp:45
CommandManager()
Initializes the command-maps.
Definition: CommandManager.cpp:3
Contains all information about a player in easy-to-use format.
Definition: Player.h:10
int RegisterAdminCommands(std::map< std::string, std::function< void(Player, std::vector< std::string >)>> methods)
Registers the admin chat commands (from the plugins).
Definition: CommandManager.cpp:27
std::map< std::string, std::function< void(Player, std::vector< std::string >)> > commands
Map with normal chat commands.
Definition: CommandManager.h:45
std::map< std::string, std::function< void(Player, std::vector< std::string >)> > adminCommands
Map with admin chat commands.
Definition: CommandManager.h:46
int RegisterCommands(std::map< std::string, std::function< void(Player, std::vector< std::string >)>> methods)
Registers the chat commands (from the plugins).
Definition: CommandManager.cpp:9
Manages the chat commands.
Definition: CommandManager.h:14