diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-19 21:42:32 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-19 21:42:32 +0200 |
commit | 427e582d5fcbd5025a81a4e89ccada47877ccc64 (patch) | |
tree | 1196585a1a6fdc39c6a05aa117cfa2766f7dca2f /source/cPluginManager.cpp | |
parent | Android: Do not create an input thread for Android (diff) | |
download | cuberite-427e582d5fcbd5025a81a4e89ccada47877ccc64.tar cuberite-427e582d5fcbd5025a81a4e89ccada47877ccc64.tar.gz cuberite-427e582d5fcbd5025a81a4e89ccada47877ccc64.tar.bz2 cuberite-427e582d5fcbd5025a81a4e89ccada47877ccc64.tar.lz cuberite-427e582d5fcbd5025a81a4e89ccada47877ccc64.tar.xz cuberite-427e582d5fcbd5025a81a4e89ccada47877ccc64.tar.zst cuberite-427e582d5fcbd5025a81a4e89ccada47877ccc64.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cPluginManager.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/source/cPluginManager.cpp b/source/cPluginManager.cpp index dd1051762..ec75a2e11 100644 --- a/source/cPluginManager.cpp +++ b/source/cPluginManager.cpp @@ -214,22 +214,6 @@ bool cPluginManager::CallHook(PluginHook a_Hook, unsigned int a_NumArgs, ...) break; } - case HOOK_DISCONNECT: - { - if( a_NumArgs != 2 ) break; - va_list argptr; - va_start( argptr, a_NumArgs); - const char* Reason = va_arg(argptr, const char* ); - cPlayer* Player = va_arg(argptr, cPlayer* ); - va_end (argptr); - for( PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr ) - { - if( (*itr)->OnDisconnect( Reason, Player ) ) - return true; - } - break; - } - case HOOK_PLAYER_JOIN: { if( a_NumArgs != 1 ) break; @@ -509,6 +493,27 @@ bool cPluginManager::CallHookCraftingNoRecipe(const cPlayer * a_Player, const cC +bool cPluginManager::CallHookDisconnect(cPlayer * a_Player, const AString & a_Reason) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_DISCONNECT); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnDisconnect(a_Player, a_Reason)) + { + return true; + } + } + return false; +} + + + + + bool cPluginManager::CallHookPostCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) { HookMap::iterator Plugins = m_Hooks.find(HOOK_POST_CRAFTING); |