Manages the plugins. More...
#include <PluginManager.h>
Public Member Functions | |
PluginManager (Config *configPtr, Methods *methodsPtr, CommandManager *commandsPtr, std::map< std::string, Player > *playersPtr, MapList *mapsPtr, sql::Connection *databasePtr, UIManager *uiPtr) | |
Initializes the pointers the plugins need. More... | |
~PluginManager () | |
Destructor closes all open plugins. | |
void | SetEventManager (EventManager *eventManagerPtr) |
Sets the event manager to be used for callbacks. More... | |
void | LoadPlugins (std::string pluginsFolder="./plugins") |
Loads the plugins in the specified folder. More... | |
void | InitializePlugins () |
Calls all Init() functions in the plugins (called after loading all plugins). | |
Private Member Functions | |
std::map< std::string, std::string > | discoverPlugins (std::string pluginsFolder) |
Disovers plugin (.so) files in the specified folder. | |
Private Attributes | |
std::map< std::string, PluginInfo > | plugins |
Vector of loaded plugins. | |
Config * | config |
Current instance of the Config. | |
CommandManager * | commands |
Current instance of the CommandManager. | |
EventManager * | events |
Current instance of the EventManager. | |
Controller * | controller |
Current instance of the controller. | |
Manages the plugins.
PluginManager::PluginManager | ( | Config * | configPtr, |
Methods * | methodsPtr, | ||
CommandManager * | commandsPtr, | ||
std::map< std::string, Player > * | playersPtr, | ||
MapList * | mapsPtr, | ||
sql::Connection * | databasePtr, | ||
UIManager * | uiPtr | ||
) |
Initializes the pointers the plugins need.
configPtr | Current instance of Config. |
methodsPtr | Current instance of Methods. |
commandsPtr | Current instance of the CommandManager. |
playersPtr | Current instance of the playerlist. |
mapsPtr | Current instance of the maplist. |
databasePtr | Current instance of the database connection. |
uiPtr | Current instance of the interface manager. |
void PluginManager::LoadPlugins | ( | std::string | pluginsFolder = "./plugins" | ) |
Loads the plugins in the specified folder.
pluginsFolder | Relative path to the plugins folder. |
void PluginManager::SetEventManager | ( | EventManager * | eventManagerPtr | ) |
Sets the event manager to be used for callbacks.
eventManagerPtr | Instance of EventManager. |