MCPcopy Create free account
hub / github.com/cuberite/cuberite / HandlePacketStatusRequest

Method HandlePacketStatusRequest

src/Protocol/Protocol17x.cpp:1484–1502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1482
1483
1484void cProtocol172::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
1485{
1486 // Send the response:
1487 AString Response = "{\"version\":{\"name\":\"1.7.2\",\"protocol\":4},\"players\":{";
1488 AppendPrintf(Response, "\"max\":%u,\"online\":%u,\"sample\":[]},",
1489 cRoot::Get()->GetServer()->GetMaxPlayers(),
1490 cRoot::Get()->GetServer()->GetNumPlayers()
1491 );
1492 AppendPrintf(Response, "\"description\":{\"text\":\"%s\"},",
1493 cRoot::Get()->GetServer()->GetDescription().c_str()
1494 );
1495 AppendPrintf(Response, "\"favicon\":\"data:image/png;base64,%s\"",
1496 cRoot::Get()->GetServer()->GetFaviconData().c_str()
1497 );
1498 Response.append("}");
1499
1500 cPacketizer Pkt(*this, 0x00); // Response packet
1501 Pkt.WriteString(Response);
1502}
1503
1504
1505

Callers

nothing calls this directly

Calls 5

GetMaxPlayersMethod · 0.80
GetServerMethod · 0.80
c_strMethod · 0.80
GetNumPlayersMethod · 0.45
WriteStringMethod · 0.45

Tested by

no test coverage detected