FeatherMC/src/ServerStatus.h

39 lines
902 B
C++

#pragma once
#include <string>
#include <sstream>
using string = std::string;
using stringstream = std::stringstream;
namespace Feather
{
class ServerStatus
{
public:
// Version
string versionName = "1.16.1";
int protocol = 736;
// Players
int maxPlayers;
int numPlayers;
// Description
string descriptionText = "";
string GetServerStatusJSON()
{
// TODO: PLACEHOLDER for real JSON
stringstream j;
j << "{";
j << "\"version\":{\"name\":\"" << versionName << "\",\"protocol\":" << protocol << "},";
j << "\"players\":{\"max\":" << maxPlayers << ",\"online\":" << numPlayers << ",\"sample\":[]},";
j << "\"description\": {\"text\":\"" << descriptionText << "\"}";
j << "}";
return j.str();
}
};
}