From 18a99085f468dfcb4ec2d9f93361b23874364d82 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 16 Jun 2012 15:06:14 +0000 Subject: Added new hooks: UPDATING_SIGN and UPDATED_SIGN. The first one is capable of changing the sign text by returning the new four lines along with the bool value git-svn-id: http://mc-server.googlecode.com/svn/trunk@622 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cPluginManager.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'source/cPluginManager.cpp') diff --git a/source/cPluginManager.cpp b/source/cPluginManager.cpp index 7c0d49ed5..f152911e8 100644 --- a/source/cPluginManager.cpp +++ b/source/cPluginManager.cpp @@ -514,7 +514,7 @@ bool cPluginManager::CallHookBlockToPickup( bool cPluginManager::CallHookWeatherChanged(cWorld * a_World) { - HookMap::iterator Plugins = m_Hooks.find(HOOK_POST_CRAFTING); + HookMap::iterator Plugins = m_Hooks.find(HOOK_WEATHER_CHANGED); if (Plugins == m_Hooks.end()) { return false; @@ -533,6 +533,49 @@ bool cPluginManager::CallHookWeatherChanged(cWorld * a_World) +bool cPluginManager::CallHookUpdatingSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_UPDATING_SIGN); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnUpdatingSign(a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookUpdatedSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_UPDATED_SIGN); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnUpdatedSign(a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4)) + { + return true; + } + } + return false; +} + + + + + + cPlugin* cPluginManager::GetPlugin( const char* a_Plugin ) const { for( PluginList::const_iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr ) -- cgit v1.2.3