summaryrefslogtreecommitdiffstats
path: root/src/Bindings/PluginLua.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-06-30 15:12:56 +0200
committerHowaner <franzi.moos@googlemail.com>2014-06-30 15:12:56 +0200
commitaa753a92c092a4d35b2ff7d08259c3196abecf67 (patch)
treebfc61dbfbc957110217460cb89d7be612ee1f944 /src/Bindings/PluginLua.cpp
parentUnnecessary return (diff)
downloadcuberite-aa753a92c092a4d35b2ff7d08259c3196abecf67.tar
cuberite-aa753a92c092a4d35b2ff7d08259c3196abecf67.tar.gz
cuberite-aa753a92c092a4d35b2ff7d08259c3196abecf67.tar.bz2
cuberite-aa753a92c092a4d35b2ff7d08259c3196abecf67.tar.lz
cuberite-aa753a92c092a4d35b2ff7d08259c3196abecf67.tar.xz
cuberite-aa753a92c092a4d35b2ff7d08259c3196abecf67.tar.zst
cuberite-aa753a92c092a4d35b2ff7d08259c3196abecf67.zip
Diffstat (limited to 'src/Bindings/PluginLua.cpp')
-rw-r--r--src/Bindings/PluginLua.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index 96c5ccde7..be27340ad 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -715,6 +715,26 @@ bool cPluginLua::OnPlayerEating(cPlayer & a_Player)
+bool cPluginLua::OnPlayerFoodLevelChange(cPlayer & a_Player, int & a_NewFoodLevel)
+{
+ cCSLock Lock(m_CriticalSection);
+ bool res = false;
+ cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FOOD_LEVEL_CHANGE];
+ for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
+ {
+ m_LuaState.Call((int)(**itr), &a_Player, a_NewFoodLevel, cLuaState::Return, res);
+ if (res)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
bool cPluginLua::OnPlayerFished(cPlayer & a_Player, const cItems & a_Reward)
{
cCSLock Lock(m_CriticalSection);