summaryrefslogtreecommitdiffstats
path: root/source/cPluginManager.cpp
diff options
context:
space:
mode:
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 );