12 #include <boost/any.hpp>
14 #include <cppconn/driver.h>
15 #include <cppconn/exception.h>
16 #include <cppconn/resultset.h>
17 #include <cppconn/statement.h>
18 #include <cppconn/prepared_statement.h>
20 #include "../Commands/ChatCommand.h"
21 #include "../Events/Structs.h"
22 #include "../Maps/MapList.h"
23 #include "../Methods/Methods.h"
24 #include "../Objects/Player.h"
25 #include "../Objects/Map.h"
26 #include "../UI/UIManager.h"
27 #include "../Utils/Logging.h"
29 #include "PluginHandler.h"
56 virtual void Init() = 0;
74 std::vector<std::function<void(Player, std::string)>>
PlayerChat;
75 std::vector<std::function<void(std::string, std::string)>>
Echo;
77 std::vector<std::function<void(std::vector<PlayerRanking>, int)>>
EndMatch;
78 std::vector<std::function<void(Map)>>
BeginMap;
79 std::vector<std::function<void(Map)>>
EndMap;
84 std::vector<std::function<void(int, int, std::string, int)>>
BillUpdated;
87 std::vector<std::function<void(std::string, std::string, std::string, std::string)>>
VoteUpdated;
91 std::map<std::string, std::function<boost::any(boost::any)>>
Methods;
107 void RegisterCommand(std::string name, std::string description, std::function<
void(
Player, std::vector<std::string>)> method)
115 Commands.insert(std::pair<std::string, ChatCommand>(name, command));
126 void RegisterAdminCommand(std::string name, std::string description, Permission access, std::function<
void(
Player, std::vector<std::string>)> method)
135 AdminCommands.insert(std::pair<std::string, ChatCommand>(name, command));
146 Methods.insert(std::pair<std::string, std::function<boost::any(boost::any)>>(name, method));
std::vector< std::function< void()> > EverySecond
Vector with functions for the EverySecond event.
Definition: Plugin.h:70
std::map< std::string, std::string > Settings
Plugin settings (from the config file).
Definition: Plugin.h:68
ServerInfo * Info
Server information instance.
Definition: Plugin.h:43
std::vector< std::function< void(int, std::string)> > StatusChanged
Vector with functions for the StatusChanged event.
Definition: Plugin.h:80
std::vector< std::function< void(Player)> > PlayerDisconnect
Vector with functions for the PlayerDisconnect event.
Definition: Plugin.h:73
Controller * controller
Struct with needed instances.
Definition: Plugin.h:98
std::vector< std::function< void(std::string, std::string, std::string, std::string)> > VoteUpdated
Vector with functions for the VoteUpdated event.
Definition: Plugin.h:87
UIManager * UI
UI manager instance.
Definition: Plugin.h:41
std::string PluginVersion
Version of the plugin the command belongs to.
Definition: ChatCommand.h:14
std::string Author
Plugin author.
Definition: Plugin.h:94
Manages the user interface on the server (ManiaLinks).
Definition: UIManager.h:17
std::map< std::string, ChatCommand > AdminCommands
Map with admin chat commands for the plugin.
Definition: Plugin.h:90
PluginHandler * Plugins
Plugin handler instance.
Definition: Plugin.h:42
std::string Description
Chat command description.
Definition: ChatCommand.h:18
Contains all information about a player in easy-to-use format.
Definition: Player.h:11
std::function< void(Player, std::vector< std::string >)> Method
Chat command method.
Definition: ChatCommand.h:20
std::map< std::string, Player > * Players
Playerlist instance.
Definition: Plugin.h:38
std::vector< std::function< void(Player, int, int, int)> > PlayerCheckpoint
Vector with functions for the PlayerCheckpoint event.
Definition: Plugin.h:81
std::string Version
Plugin version.
Definition: Plugin.h:93
std::vector< std::function< void(std::string, std::string)> > Echo
Vector with functions for the Echo event.
Definition: Plugin.h:75
Methods * Server
Methods instance.
Definition: Plugin.h:37
Plugin interface, inherited by all plugins.
Definition: Plugin.h:50
std::vector< std::function< void()> > EveryMinute
Vector with functions for the EveryMinute event.
Definition: Plugin.h:71
Contains the maplist and a pointer to the current map.
Definition: MapList.h:10
std::vector< std::function< void(Player)> > PlayerInfoChanged
Vector with functions for the PlayerInfoChanged event.
Definition: Plugin.h:86
std::vector< std::function< void(std::vector< PlayerRanking >, int)> > EndMatch
Vector with functions for the EndMatch event.
Definition: Plugin.h:77
Permission Access
Command access level.
Definition: ChatCommand.h:19
Contains all server methods and returns usable data types.
Definition: Methods.h:15
Definition: PluginHandler.h:27
std::vector< std::function< void()> > BeginMatch
Vector with functions for the BeginMatch event.
Definition: Plugin.h:76
Stuct containing information about a chat command.
Definition: ChatCommand.h:11
Struct with all instances needed for plugins.
Definition: Plugin.h:35
MapList * Maps
Maplist instance.
Definition: Plugin.h:39
virtual void Init()=0
Initializes plugin (called after loading all plugins).
std::vector< std::function< void(Player, std::string)> > PlayerChat
Vector with functions for the PlayerChat event.
Definition: Plugin.h:74
std::map< std::string, std::function< boost::any(boost::any)> > Methods
Map with callable methods for the plugin.
Definition: Plugin.h:91
std::string Description
Plugin description.
Definition: Plugin.h:95
void RegisterCallableMethod(std::string name, std::function< boost::any(boost::any)> method)
Register callable method.
Definition: Plugin.h:144
void SetController(Controller *controllerPtr)
Sets the controller instance.
Definition: Plugin.h:63
std::vector< std::function< void(int, int, std::string, int)> > BillUpdated
Vector with functions for the BillUpdated event.
Definition: Plugin.h:84
std::string Command
Chat command.
Definition: ChatCommand.h:17
std::vector< std::function< void(Player, int)> > PlayerFinish
Vector with functions for the PlayerFinish event.
Definition: Plugin.h:82
void RegisterAdminCommand(std::string name, std::string description, Permission access, std::function< void(Player, std::vector< std::string >)> method)
Register admin chat command.
Definition: Plugin.h:126
std::vector< std::function< void(Player)> > PlayerIncoherence
Vector with functions for the PlayerIncoherence event.
Definition: Plugin.h:83
sql::Connection * Database
Database instance.
Definition: Plugin.h:40
std::vector< std::function< void(Player)> > PlayerConnect
Vector with functions for the PlayerConnect event.
Definition: Plugin.h:72
void RegisterCommand(std::string name, std::string description, std::function< void(Player, std::vector< std::string >)> method)
Register chat command.
Definition: Plugin.h:107
std::vector< std::function< void(Map)> > BeginMap
Vector with functions for the BeginMap event.
Definition: Plugin.h:78
std::string PluginAuthor
Author of the plugin the command belongs to.
Definition: ChatCommand.h:15
std::vector< std::function< void(Map)> > EndMap
Vector with functions for the EndMap event.
Definition: Plugin.h:79
std::vector< std::function< void(int, int, bool)> > MapListModified
Vector with functions for the MapListModified event.
Definition: Plugin.h:85
std::map< std::string, ChatCommand > Commands
Map with normal chat commands for the plugin.
Definition: Plugin.h:89
Struct with server information.
Definition: Structs.h:41