Renamed a_Motd to a_ServerDescription.
This commit is contained in:
parent
cf5ab14ca5
commit
4da61e67d7
@ -91,7 +91,7 @@ public:
|
|||||||
virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) = 0;
|
virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) = 0;
|
||||||
virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos) = 0;
|
virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos) = 0;
|
||||||
virtual bool OnProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity) = 0;
|
virtual bool OnProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity) = 0;
|
||||||
virtual bool OnServerPing (cClientHandle & a_ClientHandle, AString & a_Motd, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon) = 0;
|
virtual bool OnServerPing (cClientHandle & a_ClientHandle, AString & a_ServerDescription, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon) = 0;
|
||||||
virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) = 0;
|
virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) = 0;
|
||||||
virtual bool OnSpawnedMonster (cWorld & a_World, cMonster & a_Monster) = 0;
|
virtual bool OnSpawnedMonster (cWorld & a_World, cMonster & a_Monster) = 0;
|
||||||
virtual bool OnSpawningEntity (cWorld & a_World, cEntity & a_Entity) = 0;
|
virtual bool OnSpawningEntity (cWorld & a_World, cEntity & a_Entity) = 0;
|
||||||
|
@ -1193,14 +1193,14 @@ bool cPluginLua::OnProjectileHitEntity(cProjectileEntity & a_Projectile, cEntity
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cPluginLua::OnServerPing(cClientHandle & a_ClientHandle, AString & a_Motd, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon)
|
bool cPluginLua::OnServerPing(cClientHandle & a_ClientHandle, AString & a_ServerDescription, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon)
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CriticalSection);
|
cCSLock Lock(m_CriticalSection);
|
||||||
bool res = false;
|
bool res = false;
|
||||||
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_SERVER_PING];
|
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_SERVER_PING];
|
||||||
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
|
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
|
||||||
{
|
{
|
||||||
m_LuaState.Call((int)(**itr), &a_ClientHandle, a_Motd, a_OnlinePlayersCount, a_MaxPlayersCount, a_Favicon, cLuaState::Return, res, a_Motd, a_OnlinePlayersCount, a_MaxPlayersCount, a_Favicon);
|
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)
|
if (res)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -117,7 +117,7 @@ public:
|
|||||||
virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
|
virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
|
||||||
virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos) override;
|
virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos) override;
|
||||||
virtual bool OnProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity) override;
|
virtual bool OnProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity) override;
|
||||||
virtual bool OnServerPing (cClientHandle & a_ClientHandle, AString & a_Motd, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon) override;
|
virtual bool OnServerPing (cClientHandle & a_ClientHandle, AString & a_ServerDescription, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon) override;
|
||||||
virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) override;
|
virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) override;
|
||||||
virtual bool OnSpawnedMonster (cWorld & a_World, cMonster & a_Monster) override;
|
virtual bool OnSpawnedMonster (cWorld & a_World, cMonster & a_Monster) override;
|
||||||
virtual bool OnSpawningEntity (cWorld & a_World, cEntity & a_Entity) override;
|
virtual bool OnSpawningEntity (cWorld & a_World, cEntity & a_Entity) override;
|
||||||
|
@ -1189,14 +1189,14 @@ bool cPluginManager::CallHookProjectileHitEntity(cProjectileEntity & a_Projectil
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cPluginManager::CallHookServerPing(cClientHandle & a_ClientHandle, AString & a_Motd, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon)
|
bool cPluginManager::CallHookServerPing(cClientHandle & a_ClientHandle, AString & a_ServerDescription, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon)
|
||||||
{
|
{
|
||||||
FIND_HOOK(HOOK_SERVER_PING);
|
FIND_HOOK(HOOK_SERVER_PING);
|
||||||
VERIFY_HOOK;
|
VERIFY_HOOK;
|
||||||
|
|
||||||
for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
|
for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
|
||||||
{
|
{
|
||||||
if ((*itr)->OnServerPing(a_ClientHandle, a_Motd, a_OnlinePlayersCount, a_MaxPlayersCount, a_Favicon))
|
if ((*itr)->OnServerPing(a_ClientHandle, a_ServerDescription, a_OnlinePlayersCount, a_MaxPlayersCount, a_Favicon))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ public:
|
|||||||
bool CallHookPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
|
bool CallHookPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
|
||||||
bool CallHookProjectileHitBlock (cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos);
|
bool CallHookProjectileHitBlock (cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos);
|
||||||
bool CallHookProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity);
|
bool CallHookProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity);
|
||||||
bool CallHookServerPing (cClientHandle & a_ClientHandle, AString & a_Motd, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon);
|
bool CallHookServerPing (cClientHandle & a_ClientHandle, AString & a_ServerDescription, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon);
|
||||||
bool CallHookSpawnedEntity (cWorld & a_World, cEntity & a_Entity);
|
bool CallHookSpawnedEntity (cWorld & a_World, cEntity & a_Entity);
|
||||||
bool CallHookSpawnedMonster (cWorld & a_World, cMonster & a_Monster);
|
bool CallHookSpawnedMonster (cWorld & a_World, cMonster & a_Monster);
|
||||||
bool CallHookSpawningEntity (cWorld & a_World, cEntity & a_Entity);
|
bool CallHookSpawningEntity (cWorld & a_World, cEntity & a_Entity);
|
||||||
|
@ -1717,11 +1717,11 @@ void cProtocol172::HandlePacketStatusPing(cByteBuffer & a_ByteBuffer)
|
|||||||
void cProtocol172::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
|
void cProtocol172::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
|
||||||
{
|
{
|
||||||
cServer * Server = cRoot::Get()->GetServer();
|
cServer * Server = cRoot::Get()->GetServer();
|
||||||
AString Motd = Server->GetDescription();
|
AString ServerDescription = Server->GetDescription();
|
||||||
int NumPlayers = Server->GetNumPlayers();
|
int NumPlayers = Server->GetNumPlayers();
|
||||||
int MaxPlayers = Server->GetMaxPlayers();
|
int MaxPlayers = Server->GetMaxPlayers();
|
||||||
AString Favicon = Server->GetFaviconData();
|
AString Favicon = Server->GetFaviconData();
|
||||||
cRoot::Get()->GetPluginManager()->CallHookServerPing(*m_Client, Motd, NumPlayers, MaxPlayers, Favicon);
|
cRoot::Get()->GetPluginManager()->CallHookServerPing(*m_Client, ServerDescription, NumPlayers, MaxPlayers, Favicon);
|
||||||
|
|
||||||
// Version:
|
// Version:
|
||||||
Json::Value Version;
|
Json::Value Version;
|
||||||
@ -1736,7 +1736,7 @@ void cProtocol172::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
|
|||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
Json::Value Description;
|
Json::Value Description;
|
||||||
Description["text"] = Motd.c_str();
|
Description["text"] = ServerDescription.c_str();
|
||||||
|
|
||||||
// Create the response:
|
// Create the response:
|
||||||
Json::Value ResponseValue;
|
Json::Value ResponseValue;
|
||||||
|
@ -1015,11 +1015,11 @@ void cProtocolRecognizer::SendLengthlessServerPing(void)
|
|||||||
AString Reply;
|
AString Reply;
|
||||||
cServer * Server = cRoot::Get()->GetServer();
|
cServer * Server = cRoot::Get()->GetServer();
|
||||||
|
|
||||||
AString Motd = Server->GetDescription();
|
AString ServerDescription = Server->GetDescription();
|
||||||
int NumPlayers = Server->GetNumPlayers();
|
int NumPlayers = Server->GetNumPlayers();
|
||||||
int MaxPlayers = Server->GetMaxPlayers();
|
int MaxPlayers = Server->GetMaxPlayers();
|
||||||
AString Favicon = Server->GetFaviconData();
|
AString Favicon = Server->GetFaviconData();
|
||||||
cRoot::Get()->GetPluginManager()->CallHookServerPing(*m_Client, Motd, NumPlayers, MaxPlayers, Favicon);
|
cRoot::Get()->GetPluginManager()->CallHookServerPing(*m_Client, ServerDescription, NumPlayers, MaxPlayers, Favicon);
|
||||||
|
|
||||||
switch (cRoot::Get()->GetPrimaryServerVersion())
|
switch (cRoot::Get()->GetPrimaryServerVersion())
|
||||||
{
|
{
|
||||||
@ -1028,7 +1028,7 @@ void cProtocolRecognizer::SendLengthlessServerPing(void)
|
|||||||
{
|
{
|
||||||
// http://wiki.vg/wiki/index.php?title=Protocol&oldid=3099#Server_List_Ping_.280xFE.29
|
// http://wiki.vg/wiki/index.php?title=Protocol&oldid=3099#Server_List_Ping_.280xFE.29
|
||||||
Printf(Reply, "%s%s%i%s%i",
|
Printf(Reply, "%s%s%i%s%i",
|
||||||
Motd.c_str(),
|
ServerDescription.c_str(),
|
||||||
cChatColor::Delimiter,
|
cChatColor::Delimiter,
|
||||||
NumPlayers,
|
NumPlayers,
|
||||||
cChatColor::Delimiter,
|
cChatColor::Delimiter,
|
||||||
@ -1072,7 +1072,7 @@ void cProtocolRecognizer::SendLengthlessServerPing(void)
|
|||||||
Reply.push_back(0);
|
Reply.push_back(0);
|
||||||
Reply.append(ProtocolVersionTxt);
|
Reply.append(ProtocolVersionTxt);
|
||||||
Reply.push_back(0);
|
Reply.push_back(0);
|
||||||
Reply.append(Motd);
|
Reply.append(ServerDescription);
|
||||||
Reply.push_back(0);
|
Reply.push_back(0);
|
||||||
Reply.append(Printf("%d", NumPlayers));
|
Reply.append(Printf("%d", NumPlayers));
|
||||||
Reply.push_back(0);
|
Reply.push_back(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user