summaryrefslogtreecommitdiffstats
path: root/source/cPluginManager.cpp
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-01-26 21:39:46 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-01-26 21:39:46 +0100
commit4e34e438f12abb31f2409ce9d50df8acc2128555 (patch)
tree68d180344b0f730779c18c927fafc07de5ee5b2b /source/cPluginManager.cpp
parentProbably fixed a deadlock! http://www.mc-server.org/support/index.php?do=details&task_id=147 (diff)
downloadcuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.tar
cuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.tar.gz
cuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.tar.bz2
cuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.tar.lz
cuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.tar.xz
cuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.tar.zst
cuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.zip
Diffstat (limited to 'source/cPluginManager.cpp')
-rw-r--r--source/cPluginManager.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/cPluginManager.cpp b/source/cPluginManager.cpp
index f1369bf46..007e0fd92 100644
--- a/source/cPluginManager.cpp
+++ b/source/cPluginManager.cpp
@@ -1,6 +1,7 @@
#include "cPluginManager.h"
#include "cPlugin.h"
#include "cPlugin_Lua.h"
+#include "cPlugin_NewLua.h"
#include "cMCLogger.h"
#include "cWebAdmin.h"
#include "cItem.h"
@@ -99,6 +100,18 @@ void cPluginManager::ReloadPluginsNow()
}
}
}
+ else if( ValueName.compare("NewPlugin") == 0 ) // New plugin style
+ {
+ std::string PluginFile = IniFile.GetValue(KeyNum, i );
+ if( !PluginFile.empty() )
+ {
+ cPlugin_NewLua* Plugin = new cPlugin_NewLua( PluginFile.c_str() );
+ if( !AddPlugin( Plugin ) )
+ {
+ delete Plugin;
+ }
+ }
+ }
#if USE_SQUIRREL
else if( ValueName.compare("Squirrel") == 0 ) // Squirrel plugin
{
@@ -481,6 +494,11 @@ cPlugin_Lua* cPluginManager::GetLuaPlugin( lua_State* a_State )
void cPluginManager::AddHook( cPlugin* a_Plugin, PluginHook a_Hook )
{
+ if( !a_Plugin )
+ {
+ LOGWARN("Called cPluginManager::AddHook while a_Plugin is NULL");
+ return;
+ }
PluginList & Plugins = m_pState->Hooks[ a_Hook ];
Plugins.remove( a_Plugin );
Plugins.push_back( a_Plugin );