summaryrefslogtreecommitdiffstats
path: root/src/Bindings/PluginManager.cpp
diff options
context:
space:
mode:
authorTycho Bickerstaff <work.tycho@gmail.com>2013-12-22 14:19:27 +0100
committerTycho Bickerstaff <work.tycho@gmail.com>2013-12-22 14:19:27 +0100
commit94ca07cfbfe0016d70963c055c87fe14f8622a4d (patch)
tree28dc91dc948287f802d9628a2ea715e1d4e0be49 /src/Bindings/PluginManager.cpp
parentChunk is now warnings clean (diff)
parentUpdate GETTING-STARTED.md (diff)
downloadcuberite-94ca07cfbfe0016d70963c055c87fe14f8622a4d.tar
cuberite-94ca07cfbfe0016d70963c055c87fe14f8622a4d.tar.gz
cuberite-94ca07cfbfe0016d70963c055c87fe14f8622a4d.tar.bz2
cuberite-94ca07cfbfe0016d70963c055c87fe14f8622a4d.tar.lz
cuberite-94ca07cfbfe0016d70963c055c87fe14f8622a4d.tar.xz
cuberite-94ca07cfbfe0016d70963c055c87fe14f8622a4d.tar.zst
cuberite-94ca07cfbfe0016d70963c055c87fe14f8622a4d.zip
Diffstat (limited to 'src/Bindings/PluginManager.cpp')
-rw-r--r--src/Bindings/PluginManager.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index 832dc4249..ffffe1a23 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -118,7 +118,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
int KeyNum = a_SettingsIni.FindKey("Plugins");
// If it does, how many plugins are there?
- unsigned int NumPlugins = ((KeyNum != -1) ? (a_SettingsIni.GetNumValues(KeyNum)) : 0);
+ int NumPlugins = ((KeyNum != -1) ? (a_SettingsIni.GetNumValues(KeyNum)) : 0);
if (KeyNum == -1)
{
@@ -126,7 +126,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
}
else if (NumPlugins > 0)
{
- for(unsigned int i = 0; i < NumPlugins; i++)
+ for (int i = 0; i < NumPlugins; i++)
{
AString ValueName = a_SettingsIni.GetValueName(KeyNum, i);
if (ValueName.compare("Plugin") == 0)
@@ -136,7 +136,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
{
if (m_Plugins.find(PluginFile) != m_Plugins.end())
{
- LoadPlugin( PluginFile );
+ LoadPlugin(PluginFile);
}
}
}
@@ -155,6 +155,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
{
LOG("-- Loaded 1 Plugin --");
}
+ CallHookPluginsLoaded();
}
@@ -987,6 +988,25 @@ bool cPluginManager::CallHookPlayerUsingItem(cPlayer & a_Player, int a_BlockX, i
+bool cPluginManager::CallHookPluginsLoaded(void)
+{
+ HookMap::iterator Plugins = m_Hooks.find(HOOK_PLUGINS_LOADED);
+ if (Plugins == m_Hooks.end())
+ {
+ return false;
+ }
+ bool res = false;
+ for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
+ {
+ res = !(*itr)->OnPluginsLoaded() || res;
+ }
+ return res;
+}
+
+
+
+
+
bool cPluginManager::CallHookPostCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe)
{
HookMap::iterator Plugins = m_Hooks.find(HOOK_POST_CRAFTING);