From bac750b24e673358ec55d3bf71c118a749fe5d0c Mon Sep 17 00:00:00 2001 From: daniel0916 Date: Sat, 25 Jan 2014 11:25:22 +0100 Subject: Added "player destroying" and "player destroyed" hooks Hooks: HOOK_PLAYER_DESTROYING HOOK_PLAYER_DESTROYED Idea from: https://github.com/mc-server/MCServer/issues/473 --- src/Bindings/PluginManager.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/Bindings/PluginManager.cpp') diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 24bb914d1..1bab8cb0f 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -673,6 +673,48 @@ bool cPluginManager::CallHookPlayerBrokenBlock(cPlayer & a_Player, int a_BlockX, +bool cPluginManager::CallHookPlayerDestroying(cPlayer & a_Player) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_DESTROYING); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerDestroying(a_Player)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerDestroyed(cPlayer & a_Player) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_DESTROYED); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerDestroyed(a_Player)) + { + return true; + } + } + return false; +} + + + + + bool cPluginManager::CallHookPlayerEating(cPlayer & a_Player) { HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_EATING); -- cgit v1.2.3 From dbbd47b96d3b3dd5ca0680eda8191808f30e3927 Mon Sep 17 00:00:00 2001 From: daniel0916 Date: Sat, 1 Feb 2014 13:27:44 +0100 Subject: Removed "player destroying" hook --- src/Bindings/PluginManager.cpp | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'src/Bindings/PluginManager.cpp') diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 1bab8cb0f..9e318554a 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -673,27 +673,6 @@ bool cPluginManager::CallHookPlayerBrokenBlock(cPlayer & a_Player, int a_BlockX, -bool cPluginManager::CallHookPlayerDestroying(cPlayer & a_Player) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_DESTROYING); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerDestroying(a_Player)) - { - return true; - } - } - return false; -} - - - - - bool cPluginManager::CallHookPlayerDestroyed(cPlayer & a_Player) { HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_DESTROYED); -- cgit v1.2.3