summaryrefslogtreecommitdiffstats
path: root/source/PluginManager.h
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-21 21:29:30 +0200
committermadmaxoft <github@xoft.cz>2013-08-21 21:29:30 +0200
commitf3a0fed72427e747d2c8c9599dd8279ff598dc28 (patch)
tree07bacb9492aeb37205b50c249e798fdc5993d82d /source/PluginManager.h
parentcLuaState: Added LogStackTrace() and GetTypeText() utility functions (diff)
downloadcuberite-f3a0fed72427e747d2c8c9599dd8279ff598dc28.tar
cuberite-f3a0fed72427e747d2c8c9599dd8279ff598dc28.tar.gz
cuberite-f3a0fed72427e747d2c8c9599dd8279ff598dc28.tar.bz2
cuberite-f3a0fed72427e747d2c8c9599dd8279ff598dc28.tar.lz
cuberite-f3a0fed72427e747d2c8c9599dd8279ff598dc28.tar.xz
cuberite-f3a0fed72427e747d2c8c9599dd8279ff598dc28.tar.zst
cuberite-f3a0fed72427e747d2c8c9599dd8279ff598dc28.zip
Diffstat (limited to '')
-rw-r--r--source/PluginManager.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/source/PluginManager.h b/source/PluginManager.h
index 0933d389f..816e4a40c 100644
--- a/source/PluginManager.h
+++ b/source/PluginManager.h
@@ -110,6 +110,10 @@ public: // tolua_export
// Note that if a hook type is added, it may need processing in cPlugin::CanAddHook() descendants,
// and it definitely needs adding in cPluginLua::GetHookFnName() !
+
+ // Keep these two as the last items, they are used for validity checking and get their values automagically
+ HOOK_NUM_HOOKS,
+ HOOK_MAX = HOOK_NUM_HOOKS - 1,
} ;
// tolua_end
@@ -133,7 +137,9 @@ public: // tolua_export
void FindPlugins(); // tolua_export
void ReloadPlugins(); // tolua_export
- void AddHook( cPlugin* a_Plugin, PluginHook a_Hook ); // tolua_export
+
+ /// Adds the plugin to the list of plugins called for the specified hook type. Handles multiple adds as a single add
+ void AddHook(cPlugin * a_Plugin, int a_HookType);
unsigned int GetNumPlugins() const; // tolua_export
@@ -237,6 +243,9 @@ public: // tolua_export
*/
void TabCompleteCommand(const AString & a_Text, AStringVector & a_Results, cPlayer * a_Player);
+ /// Returns true if the specified hook type is within the allowed range
+ static bool IsValidHookType(int a_HookType);
+
private:
friend class cRoot;
@@ -248,7 +257,7 @@ private:
AString m_HelpString;
} ;
- typedef std::map< cPluginManager::PluginHook, cPluginManager::PluginList > HookMap;
+ typedef std::map<int, cPluginManager::PluginList> HookMap;
typedef std::map<AString, cCommandReg> CommandMap;
PluginList m_DisablePluginList;