diff options
author | daniel0916 <theschokolps@gmail.com> | 2014-02-01 13:27:44 +0100 |
---|---|---|
committer | daniel0916 <theschokolps@gmail.com> | 2014-02-01 13:27:44 +0100 |
commit | dbbd47b96d3b3dd5ca0680eda8191808f30e3927 (patch) | |
tree | 61444f8f6ce82e59b5693676bb437dfe6733bc82 /src | |
parent | Added "player destroying" and "player destroyed" hooks (diff) | |
download | cuberite-dbbd47b96d3b3dd5ca0680eda8191808f30e3927.tar cuberite-dbbd47b96d3b3dd5ca0680eda8191808f30e3927.tar.gz cuberite-dbbd47b96d3b3dd5ca0680eda8191808f30e3927.tar.bz2 cuberite-dbbd47b96d3b3dd5ca0680eda8191808f30e3927.tar.lz cuberite-dbbd47b96d3b3dd5ca0680eda8191808f30e3927.tar.xz cuberite-dbbd47b96d3b3dd5ca0680eda8191808f30e3927.tar.zst cuberite-dbbd47b96d3b3dd5ca0680eda8191808f30e3927.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/Bindings/Plugin.h | 1 | ||||
-rw-r--r-- | src/Bindings/PluginLua.cpp | 20 | ||||
-rw-r--r-- | src/Bindings/PluginLua.h | 1 | ||||
-rw-r--r-- | src/Bindings/PluginManager.cpp | 21 | ||||
-rw-r--r-- | src/Bindings/PluginManager.h | 2 | ||||
-rw-r--r-- | src/Entities/Player.cpp | 4 |
6 files changed, 1 insertions, 48 deletions
diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h index f50d1f561..949e4693a 100644 --- a/src/Bindings/Plugin.h +++ b/src/Bindings/Plugin.h @@ -67,7 +67,6 @@ public: virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) = 0; virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; - virtual bool OnPlayerDestroying (cPlayer & a_Player) = 0; virtual bool OnPlayerDestroyed (cPlayer & a_Player) = 0; virtual bool OnPlayerEating (cPlayer & a_Player) = 0; virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) = 0; diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 2b34e92c9..7fc1db391 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -623,26 +623,6 @@ bool cPluginLua::OnPlayerBrokenBlock(cPlayer & a_Player, int a_BlockX, int a_Blo -bool cPluginLua::OnPlayerDestroying(cPlayer & a_Player) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_DESTROYING]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - bool cPluginLua::OnPlayerDestroyed(cPlayer & a_Player) { cCSLock Lock(m_CriticalSection); diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index f173be179..589de66fa 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -64,7 +64,6 @@ public: virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) override; virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual bool OnPlayerDestroying (cPlayer & a_Player) override; virtual bool OnPlayerDestroyed (cPlayer & a_Player) override; virtual bool OnPlayerEating (cPlayer & a_Player) override; virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) override; 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); diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index 38d5a8ca3..a700ef6ce 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -79,7 +79,6 @@ public: // tolua_export HOOK_LOGIN, HOOK_PLAYER_BREAKING_BLOCK, HOOK_PLAYER_BROKEN_BLOCK, - HOOK_PLAYER_DESTROYING, HOOK_PLAYER_DESTROYED, HOOK_PLAYER_EATING, HOOK_PLAYER_FISHED, @@ -172,7 +171,6 @@ public: // tolua_export bool CallHookPlayerAnimation (cPlayer & a_Player, int a_Animation); bool CallHookPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); - bool CallHookPlayerDestroying (cPlayer & a_Player); bool CallHookPlayerDestroyed (cPlayer & a_Player); bool CallHookPlayerEating (cPlayer & a_Player); bool CallHookPlayerFished (cPlayer & a_Player, const cItems a_Reward); diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index abdd792e0..9a935520f 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -120,7 +120,7 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) cPlayer::~cPlayer(void) { - cRoot::Get()->GetPluginManager()->CallHookPlayerDestroying(*this); + cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this); LOGD("Deleting cPlayer \"%s\" at %p, ID %d", m_PlayerName.c_str(), this, GetUniqueID()); @@ -136,8 +136,6 @@ cPlayer::~cPlayer(void) delete m_InventoryWindow; LOGD("Player %p deleted", this); - - cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this); } |