summaryrefslogtreecommitdiffstats
path: root/src/Bindings/PluginLua.cpp
diff options
context:
space:
mode:
authorSTRWarrior <STRWarrior@users.noreply.github.com>2014-08-20 22:57:48 +0200
committerSTRWarrior <STRWarrior@users.noreply.github.com>2014-08-20 22:57:48 +0200
commit3a113e3a75bb345d008e13bbecae5f78ed9d9aae (patch)
treed2d17b4c0091905cb55245305292ada6dcb11d71 /src/Bindings/PluginLua.cpp
parentMerge pull request #1335 from mc-server/CodeFixes (diff)
parentRenamed a_Motd to a_ServerDescription. (diff)
downloadcuberite-3a113e3a75bb345d008e13bbecae5f78ed9d9aae.tar
cuberite-3a113e3a75bb345d008e13bbecae5f78ed9d9aae.tar.gz
cuberite-3a113e3a75bb345d008e13bbecae5f78ed9d9aae.tar.bz2
cuberite-3a113e3a75bb345d008e13bbecae5f78ed9d9aae.tar.lz
cuberite-3a113e3a75bb345d008e13bbecae5f78ed9d9aae.tar.xz
cuberite-3a113e3a75bb345d008e13bbecae5f78ed9d9aae.tar.zst
cuberite-3a113e3a75bb345d008e13bbecae5f78ed9d9aae.zip
Diffstat (limited to '')
-rw-r--r--src/Bindings/PluginLua.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index 37db78994..d0b4fa617 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -1193,6 +1193,26 @@ bool cPluginLua::OnProjectileHitEntity(cProjectileEntity & a_Projectile, cEntity
+bool cPluginLua::OnServerPing(cClientHandle & a_ClientHandle, AString & a_ServerDescription, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon)
+{
+ cCSLock Lock(m_CriticalSection);
+ bool res = false;
+ cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_SERVER_PING];
+ for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
+ {
+ m_LuaState.Call((int)(**itr), &a_ClientHandle, a_ServerDescription, a_OnlinePlayersCount, a_MaxPlayersCount, a_Favicon, cLuaState::Return, res, a_ServerDescription, a_OnlinePlayersCount, a_MaxPlayersCount, a_Favicon);
+ if (res)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
bool cPluginLua::OnSpawnedEntity(cWorld & a_World, cEntity & a_Entity)
{
cCSLock Lock(m_CriticalSection);
@@ -1570,6 +1590,7 @@ const char * cPluginLua::GetHookFnName(int a_HookType)
case cPluginManager::HOOK_PLUGINS_LOADED: return "OnPluginsLoaded";
case cPluginManager::HOOK_POST_CRAFTING: return "OnPostCrafting";
case cPluginManager::HOOK_PRE_CRAFTING: return "OnPreCrafting";
+ case cPluginManager::HOOK_SERVER_PING: return "OnServerPing";
case cPluginManager::HOOK_SPAWNED_ENTITY: return "OnSpawnedEntity";
case cPluginManager::HOOK_SPAWNED_MONSTER: return "OnSpawnedMonster";
case cPluginManager::HOOK_SPAWNING_ENTITY: return "OnSpawningEntity";