diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2013-12-30 22:56:08 +0100 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2013-12-30 22:56:08 +0100 |
commit | cd435ffca970f954d2ade1e81c7c4ae7df75907e (patch) | |
tree | 76dd51fc9c073abcc96b7a4ce3d998438f137bba /src/Bindings/PluginLua.cpp | |
parent | Fixed compilation in VC2008. (diff) | |
download | cuberite-cd435ffca970f954d2ade1e81c7c4ae7df75907e.tar cuberite-cd435ffca970f954d2ade1e81c7c4ae7df75907e.tar.gz cuberite-cd435ffca970f954d2ade1e81c7c4ae7df75907e.tar.bz2 cuberite-cd435ffca970f954d2ade1e81c7c4ae7df75907e.tar.lz cuberite-cd435ffca970f954d2ade1e81c7c4ae7df75907e.tar.xz cuberite-cd435ffca970f954d2ade1e81c7c4ae7df75907e.tar.zst cuberite-cd435ffca970f954d2ade1e81c7c4ae7df75907e.zip |
Diffstat (limited to 'src/Bindings/PluginLua.cpp')
-rw-r--r-- | src/Bindings/PluginLua.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 69e83fb0a..66a60efe8 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -630,6 +630,46 @@ bool cPluginLua::OnPlayerEating(cPlayer & a_Player) +bool cPluginLua::OnPlayerFished(cPlayer & a_Player, cItems & a_Reward) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHED]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, &a_Reward, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerFishing(cPlayer & a_Player, cItems & a_Reward) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHING]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, &a_Reward, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + bool cPluginLua::OnPlayerJoined(cPlayer & a_Player) { cCSLock Lock(m_CriticalSection); |