diff options
author | Tycho Bickerstaff <work.tycho@gmail.com> | 2013-12-31 17:32:08 +0100 |
---|---|---|
committer | Tycho Bickerstaff <work.tycho@gmail.com> | 2013-12-31 17:32:08 +0100 |
commit | 7694a0788c796cb08539dcdc3ed4bf9eee3babbf (patch) | |
tree | 78873e56309a8eb45b47de6a2d775763568a5a4e /src/Bindings/PluginLua.cpp | |
parent | fogot to add promise classes (diff) | |
parent | Merge pull request #484 from worktycho/cmake-fixes (diff) | |
download | cuberite-7694a0788c796cb08539dcdc3ed4bf9eee3babbf.tar cuberite-7694a0788c796cb08539dcdc3ed4bf9eee3babbf.tar.gz cuberite-7694a0788c796cb08539dcdc3ed4bf9eee3babbf.tar.bz2 cuberite-7694a0788c796cb08539dcdc3ed4bf9eee3babbf.tar.lz cuberite-7694a0788c796cb08539dcdc3ed4bf9eee3babbf.tar.xz cuberite-7694a0788c796cb08539dcdc3ed4bf9eee3babbf.tar.zst cuberite-7694a0788c796cb08539dcdc3ed4bf9eee3babbf.zip |
Diffstat (limited to '')
-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..87212ed85 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, const 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); |