summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_10.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Protocol/Protocol_1_10.cpp')
-rw-r--r--src/Protocol/Protocol_1_10.cpp44
1 files changed, 4 insertions, 40 deletions
diff --git a/src/Protocol/Protocol_1_10.cpp b/src/Protocol/Protocol_1_10.cpp
index 300b4d381..3ace0fe43 100644
--- a/src/Protocol/Protocol_1_10.cpp
+++ b/src/Protocol/Protocol_1_10.cpp
@@ -332,54 +332,18 @@ void cProtocol_1_10_0::SendSoundEffect(const AString & a_SoundName, double a_X,
-void cProtocol_1_10_0::HandlePacketResourcePackStatus(cByteBuffer & a_ByteBuffer)
+cProtocol::Version cProtocol_1_10_0::GetProtocolVersion()
{
- HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Status);
+ return Version::Version_1_10_0;
}
-void cProtocol_1_10_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
+void cProtocol_1_10_0::HandlePacketResourcePackStatus(cByteBuffer & a_ByteBuffer)
{
- cServer * Server = cRoot::Get()->GetServer();
- AString ServerDescription = Server->GetDescription();
- auto NumPlayers = static_cast<signed>(Server->GetNumPlayers());
- auto MaxPlayers = static_cast<signed>(Server->GetMaxPlayers());
- AString Favicon = Server->GetFaviconData();
- cRoot::Get()->GetPluginManager()->CallHookServerPing(*m_Client, ServerDescription, NumPlayers, MaxPlayers, Favicon);
-
- // Version:
- Json::Value Version;
- Version["name"] = "Cuberite 1.10";
- Version["protocol"] = 210;
-
- // Players:
- Json::Value Players;
- Players["online"] = NumPlayers;
- Players["max"] = MaxPlayers;
- // TODO: Add "sample"
-
- // Description:
- Json::Value Description;
- Description["text"] = ServerDescription.c_str();
-
- // Create the response:
- Json::Value ResponseValue;
- ResponseValue["version"] = Version;
- ResponseValue["players"] = Players;
- ResponseValue["description"] = Description;
- m_Client->ForgeAugmentServerListPing(ResponseValue);
- if (!Favicon.empty())
- {
- ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str());
- }
-
- AString Response = JsonUtils::WriteFastString(ResponseValue);
-
- cPacketizer Pkt(*this, pktStatusResponse);
- Pkt.WriteString(Response);
+ HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Status);
}