diff options
author | joshi07 <schumacher@20ma.de> | 2015-03-05 11:52:42 +0100 |
---|---|---|
committer | joshi07 <schumacher@20ma.de> | 2015-03-05 11:52:42 +0100 |
commit | f71b1fe799eb944b9488019da134a6cc34675605 (patch) | |
tree | f142764f84560a9761bf7d70efbdf4f6d28d0421 /src/Bindings/PluginLua.cpp | |
parent | Lua API: Fixed md5 and sha1 hex formatting. (diff) | |
download | cuberite-f71b1fe799eb944b9488019da134a6cc34675605.tar cuberite-f71b1fe799eb944b9488019da134a6cc34675605.tar.gz cuberite-f71b1fe799eb944b9488019da134a6cc34675605.tar.bz2 cuberite-f71b1fe799eb944b9488019da134a6cc34675605.tar.lz cuberite-f71b1fe799eb944b9488019da134a6cc34675605.tar.xz cuberite-f71b1fe799eb944b9488019da134a6cc34675605.tar.zst cuberite-f71b1fe799eb944b9488019da134a6cc34675605.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/PluginLua.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 500913e76..fb7650d42 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -857,6 +857,26 @@ bool cPluginLua::OnPlayerMoving(cPlayer & a_Player, const Vector3d & a_OldPositi +bool cPluginLua::OnEntityTeleport(cEntity & a_Entity, const Vector3d & a_OldPosition, const Vector3d & a_NewPosition) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_ENTITY_TELEPORT]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Entity, a_OldPosition, a_NewPosition, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + bool cPluginLua::OnPlayerPlacedBlock(cPlayer & a_Player, const sSetBlock & a_BlockChange) { cCSLock Lock(m_CriticalSection); @@ -1577,6 +1597,7 @@ const char * cPluginLua::GetHookFnName(int a_HookType) case cPluginManager::HOOK_DISCONNECT: return "OnDisconnect"; case cPluginManager::HOOK_PLAYER_ANIMATION: return "OnPlayerAnimation"; case cPluginManager::HOOK_ENTITY_ADD_EFFECT: return "OnEntityAddEffect"; + case cPluginManager::HOOK_ENTITY_TELEPORT: return "OnEntityTeleport"; case cPluginManager::HOOK_EXECUTE_COMMAND: return "OnExecuteCommand"; case cPluginManager::HOOK_HANDSHAKE: return "OnHandshake"; case cPluginManager::HOOK_KILLING: return "OnKilling"; |