diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-24 11:49:00 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-24 11:49:00 +0200 |
commit | f0fc0edd21b9340ce48561a5fceee29e4e055dff (patch) | |
tree | 658ec25a188e8ebe16ea43f201797601d6254d35 /source/cPluginManager.cpp | |
parent | Ignore some runtime folders (diff) | |
download | cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.tar cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.tar.gz cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.tar.bz2 cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.tar.lz cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.tar.xz cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.tar.zst cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.zip |
Diffstat (limited to 'source/cPluginManager.cpp')
-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 041180818..788b5e429 100644 --- a/source/cPluginManager.cpp +++ b/source/cPluginManager.cpp @@ -198,22 +198,6 @@ bool cPluginManager::CallHook(PluginHook a_Hook, unsigned int a_NumArgs, ...) switch( a_Hook ) { - case HOOK_COLLECT_ITEM: - { - if( a_NumArgs != 2 ) break; - va_list argptr; - va_start( argptr, a_NumArgs); - cPickup* Pickup = va_arg(argptr, cPickup* ); - cPlayer* Player = va_arg(argptr, cPlayer* ); - va_end (argptr); - for( PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr ) - { - if( (*itr)->OnCollectItem( Pickup, Player ) ) - return true; - } - break; - } - case HOOK_PLAYER_JOIN: { if( a_NumArgs != 1 ) break; @@ -451,6 +435,27 @@ bool cPluginManager::CallHookChunkGenerating(cWorld * a_World, int a_ChunkX, int +bool cPluginManager::CallHookCollectPickup(cPlayer * a_Player, cPickup & a_Pickup) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_COLLECT_PICKUP); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnCollectPickup(a_Player, &a_Pickup)) + { + return true; + } + } + return false; +} + + + + + bool cPluginManager::CallHookPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) { HookMap::iterator Plugins = m_Hooks.find(HOOK_PRE_CRAFTING); |