summaryrefslogtreecommitdiffstats
path: root/src/Bindings/PluginLua.cpp
diff options
context:
space:
mode:
authorTycho Bickerstaff <work.tycho@gmail.com>2013-12-31 17:24:53 +0100
committerTycho Bickerstaff <work.tycho@gmail.com>2013-12-31 17:24:53 +0100
commitc52a46a5e3915fab58ad4c28086b19a1cbcf5755 (patch)
treef1fd5c77ebf7ccb130700a97fe7c9c8c02d411b5 /src/Bindings/PluginLua.cpp
parentMerge branch 'master' into cmake-fixes (diff)
parentMerge branch 'FishingHook' (diff)
downloadcuberite-c52a46a5e3915fab58ad4c28086b19a1cbcf5755.tar
cuberite-c52a46a5e3915fab58ad4c28086b19a1cbcf5755.tar.gz
cuberite-c52a46a5e3915fab58ad4c28086b19a1cbcf5755.tar.bz2
cuberite-c52a46a5e3915fab58ad4c28086b19a1cbcf5755.tar.lz
cuberite-c52a46a5e3915fab58ad4c28086b19a1cbcf5755.tar.xz
cuberite-c52a46a5e3915fab58ad4c28086b19a1cbcf5755.tar.zst
cuberite-c52a46a5e3915fab58ad4c28086b19a1cbcf5755.zip
Diffstat (limited to 'src/Bindings/PluginLua.cpp')
-rw-r--r--src/Bindings/PluginLua.cpp40
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);