diff options
author | Mattes D <github@xoft.cz> | 2015-03-05 13:57:19 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-03-05 13:57:19 +0100 |
commit | 78120db487e775bc294d8222581b6791456cc380 (patch) | |
tree | f142764f84560a9761bf7d70efbdf4f6d28d0421 /src/Bindings/PluginLua.cpp | |
parent | Lua API: Fixed md5 and sha1 hex formatting. (diff) | |
parent | Added OnTeleportEntity hook for plugins. (diff) | |
download | cuberite-78120db487e775bc294d8222581b6791456cc380.tar cuberite-78120db487e775bc294d8222581b6791456cc380.tar.gz cuberite-78120db487e775bc294d8222581b6791456cc380.tar.bz2 cuberite-78120db487e775bc294d8222581b6791456cc380.tar.lz cuberite-78120db487e775bc294d8222581b6791456cc380.tar.xz cuberite-78120db487e775bc294d8222581b6791456cc380.tar.zst cuberite-78120db487e775bc294d8222581b6791456cc380.zip |
Diffstat (limited to 'src/Bindings/PluginLua.cpp')
-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"; |