summaryrefslogtreecommitdiffstats
path: root/src/Bindings/PluginLua.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-01-01 15:31:57 +0100
committermadmaxoft <github@xoft.cz>2014-01-01 15:31:57 +0100
commitd4e29a0d183151ecdb5b9c8e710c810802c9f35b (patch)
tree75b116fe37cdb6c389339d5eccc4a4939e28df2d /src/Bindings/PluginLua.cpp
parentMerge pull request #497 from xdot/master (diff)
parentLittle more documentation for OnPlayerFishing. (diff)
downloadcuberite-d4e29a0d183151ecdb5b9c8e710c810802c9f35b.tar
cuberite-d4e29a0d183151ecdb5b9c8e710c810802c9f35b.tar.gz
cuberite-d4e29a0d183151ecdb5b9c8e710c810802c9f35b.tar.bz2
cuberite-d4e29a0d183151ecdb5b9c8e710c810802c9f35b.tar.lz
cuberite-d4e29a0d183151ecdb5b9c8e710c810802c9f35b.tar.xz
cuberite-d4e29a0d183151ecdb5b9c8e710c810802c9f35b.tar.zst
cuberite-d4e29a0d183151ecdb5b9c8e710c810802c9f35b.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);