summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_10.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-07-18 19:57:23 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-07-18 20:23:10 +0200
commit5141d05ba676df9584831ffa9ff6e8ff8905887d (patch)
tree34a516e598fb0aeece8d728ad8f978d3d00fd0d0 /src/Protocol/Protocol_1_10.cpp
parent1.13 items support (diff)
downloadcuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.tar
cuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.tar.gz
cuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.tar.bz2
cuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.tar.lz
cuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.tar.xz
cuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.tar.zst
cuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.zip
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);
}