summaryrefslogtreecommitdiffstats
path: root/src/Bindings/PluginLua.cpp
diff options
context:
space:
mode:
authordaniel0916 <theschokolps@gmail.com>2014-01-25 11:25:22 +0100
committerdaniel0916 <theschokolps@gmail.com>2014-01-25 11:25:22 +0100
commitbac750b24e673358ec55d3bf71c118a749fe5d0c (patch)
treeb939a88d40583897876fe66d6355233fd6ef6b14 /src/Bindings/PluginLua.cpp
parentAPIDump: Added notes about objects across cWorld's task execution. (diff)
downloadcuberite-bac750b24e673358ec55d3bf71c118a749fe5d0c.tar
cuberite-bac750b24e673358ec55d3bf71c118a749fe5d0c.tar.gz
cuberite-bac750b24e673358ec55d3bf71c118a749fe5d0c.tar.bz2
cuberite-bac750b24e673358ec55d3bf71c118a749fe5d0c.tar.lz
cuberite-bac750b24e673358ec55d3bf71c118a749fe5d0c.tar.xz
cuberite-bac750b24e673358ec55d3bf71c118a749fe5d0c.tar.zst
cuberite-bac750b24e673358ec55d3bf71c118a749fe5d0c.zip
Diffstat (limited to '')
-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 4c4664815..2b34e92c9 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -623,6 +623,46 @@ bool cPluginLua::OnPlayerBrokenBlock(cPlayer & a_Player, int a_BlockX, int a_Blo
+bool cPluginLua::OnPlayerDestroying(cPlayer & a_Player)
+{
+ cCSLock Lock(m_CriticalSection);
+ bool res = false;
+ cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_DESTROYING];
+ for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
+ {
+ m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res);
+ if (res)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
+bool cPluginLua::OnPlayerDestroyed(cPlayer & a_Player)
+{
+ cCSLock Lock(m_CriticalSection);
+ bool res = false;
+ cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_DESTROYED];
+ for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
+ {
+ m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res);
+ if (res)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
bool cPluginLua::OnPlayerEating(cPlayer & a_Player)
{
cCSLock Lock(m_CriticalSection);