61 $endpoint =
"http://" . $server->getConfigGroup()->getPropertyString(YmlServerProperties::ANONYMOUS_STATISTICS_HOST,
"stats.pocketmine.net") .
"/";
64 $data[
"uniqueServerId"] = $server->getServerUniqueId()->toString();
65 $data[
"uniqueMachineId"] = Utils::getMachineUniqueId()->toString();
66 $data[
"uniqueRequestId"] = Uuid::uuid3($server->getServerUniqueId()->toString(), microtime(
false))->toString();
70 $data[
"event"] =
"open";
72 $version = VersionInfo::VERSION();
75 "port" => $server->getPort(),
76 "software" => $server->getName(),
77 "fullVersion" => $version->getFullVersion(
true),
78 "version" => $version->getFullVersion(
false),
79 "build" => $version->getBuild(),
80 "api" => $server->getApiVersion(),
81 "minecraftVersion" => $server->getVersion(),
82 "protocol" => ProtocolInfo::CURRENT_PROTOCOL
86 "operatingSystem" => Utils::getOS(),
87 "cores" => Utils::getCoreCount(),
88 "phpVersion" => PHP_VERSION,
89 "machine" => php_uname(
"a"),
90 "release" => php_uname(
"r"),
91 "platform" => php_uname(
"i")
96 "limit" => $server->getMaxPlayers()
101 foreach($server->getPluginManager()->getPlugins() as $p){
102 $d = $p->getDescription();
104 $plugins[$d->getName()] = [
105 "name" => $d->getName(),
106 "version" => $d->getVersion(),
107 "enabled" => $p->isEnabled()
111 $data[
"plugins"] = $plugins;
114 case self::TYPE_STATUS:
115 $data[
"event"] =
"status";
120 "ticks" => $server->getTick()
124 $playerList = array_map(
'md5', $playerList);
126 $players = array_map(
function(
Player $p) :
string{
return md5($p->getUniqueId()->getBytes()); }, $server->
getOnlinePlayers());
129 "count" => count($players),
130 "limit" => $server->getMaxPlayers(),
131 "currentList" => array_values($players),
132 "historyList" => array_values($playerList)
135 $info = Process::getAdvancedMemoryUsage();
137 "mainMemory" => $info[0],
138 "totalMemory" => $info[1],
139 "availableMemory" => $info[2],
140 "threadCount" => Process::getThreadCount()
144 case self::TYPE_CLOSE:
145 $data[
"event"] =
"close";
146 $data[
"crashing"] = $server->isRunning();
150 $this->endpoint = $endpoint .
"api/post";
151 $this->data = json_encode($data, JSON_THROW_ON_ERROR);