summaryrefslogtreecommitdiffstats
path: root/source/cPluginManager.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-18 11:56:28 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-18 11:56:28 +0200
commit2691e8daed826e944ca38f4787c77273edbf9404 (patch)
tree3f9fca349df2253c2c314abf2e0c22e8af7f9604 /source/cPluginManager.cpp
parentAdded Core files to the VC2008 project (so that they can be opened from the IDE there, nothing more) (diff)
downloadcuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.gz
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.bz2
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.lz
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.xz
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.zst
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.zip
Diffstat (limited to '')
-rw-r--r--source/cPluginManager.cpp113
1 files changed, 64 insertions, 49 deletions
diff --git a/source/cPluginManager.cpp b/source/cPluginManager.cpp
index b3392e356..c64b466c2 100644
--- a/source/cPluginManager.cpp
+++ b/source/cPluginManager.cpp
@@ -262,40 +262,7 @@ bool cPluginManager::CallHook(PluginHook a_Hook, unsigned int a_NumArgs, ...)
}
break;
}
-
- case HOOK_BLOCK_DIG:
- {
- if( a_NumArgs != 2 ) break;
- va_list argptr;
- va_start( argptr, a_NumArgs);
- cPacket_BlockDig* Packet = va_arg(argptr, cPacket_BlockDig* );
- cPlayer* Player = va_arg(argptr, cPlayer* );
- cItem* Item = va_arg( argptr, cItem* );
- va_end (argptr);
- for( PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr )
- {
- if( (*itr)->OnBlockDig( Packet, Player, Item ) )
- return true;
- }
- break;
- }
-
- case HOOK_BLOCK_PLACE:
- {
- if( a_NumArgs != 2 ) break;
- va_list argptr;
- va_start( argptr, a_NumArgs);
- cPacket_BlockPlace* Packet = va_arg(argptr, cPacket_BlockPlace* );
- cPlayer* Player = va_arg(argptr, cPlayer* );
- va_end (argptr);
- for( PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr )
- {
- if( (*itr)->OnBlockPlace( Packet, Player ) )
- return true;
- }
- break;
- }
-
+
case HOOK_DISCONNECT:
{
if( a_NumArgs != 2 ) break;
@@ -312,21 +279,6 @@ bool cPluginManager::CallHook(PluginHook a_Hook, unsigned int a_NumArgs, ...)
break;
}
- case HOOK_LOGIN:
- {
- if( a_NumArgs != 1 ) break;
- va_list argptr;
- va_start( argptr, a_NumArgs);
- cPacket_Login* Packet = va_arg(argptr, cPacket_Login* );
- va_end (argptr);
- for( PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr )
- {
- if( (*itr)->OnLogin( Packet ) )
- return true;
- }
- break;
- }
-
case HOOK_PLAYER_JOIN:
{
if( a_NumArgs != 1 ) break;
@@ -437,6 +389,69 @@ bool cPluginManager::CallHook(PluginHook a_Hook, unsigned int a_NumArgs, ...)
+bool cPluginManager::CallHookLogin(cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username)
+{
+ HookMap::iterator Plugins = m_Hooks.find(HOOK_LOGIN);
+ if (Plugins == m_Hooks.end())
+ {
+ return false;
+ }
+ for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
+ {
+ if ((*itr)->OnLogin(a_Client, a_ProtocolVersion, a_Username))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
+bool cPluginManager::CallHookBlockDig(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status, BLOCKTYPE a_OldBlock, NIBBLETYPE a_OldMeta)
+{
+ HookMap::iterator Plugins = m_Hooks.find(HOOK_BLOCK_DIG);
+ if (Plugins == m_Hooks.end())
+ {
+ return false;
+ }
+ for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
+ {
+ if ((*itr)->OnBlockDig(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status, a_OldBlock, a_OldMeta))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
+bool cPluginManager::CallHookBlockPlace(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, const cItem & a_HeldItem)
+{
+ HookMap::iterator Plugins = m_Hooks.find(HOOK_BLOCK_PLACE);
+ if (Plugins == m_Hooks.end())
+ {
+ return false;
+ }
+ for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
+ {
+ if ((*itr)->OnBlockPlace(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_HeldItem))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
bool cPluginManager::CallHookChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_LuaChunk)
{
HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_GENERATING);