public function sendUsage($type = SendUsageTask::TYPE_STATUS) { $this->scheduler->scheduleAsyncTask(new SendUsageTask($this, $type, $this->uniquePlayers)); $this->uniquePlayers = []; }
public function sendUsage() { if ($this->lastSendUsage instanceof SendUsageTask) { if (!$this->lastSendUsage->isGarbage()) { //do not call multiple times return; } } $plist = ""; foreach ($this->getPluginManager()->getPlugins() as $p) { $d = $p->getDescription(); $plist .= str_replace([";", ":"], "", $d->getName()) . ":" . str_replace([";", ":"], "", $d->getVersion()) . ";"; } $version = new VersionString(); $this->lastSendUsage = new SendUsageTask("http://stats.pocketmine.net/usage.php", ["serverid" => 0, "port" => $this->getPort(), "os" => Utils::getOS(), "name" => $this->getName(), "memory_total" => $this->getConfigString("memory-limit"), "memory_usage" => memory_get_usage(), "php_version" => PHP_VERSION, "version" => $version->get(true), "build" => $version->getBuild(), "mc_version" => \pocketmine\MINECRAFT_VERSION, "protocol" => \pocketmine\network\protocol\Info::CURRENT_PROTOCOL, "online" => count($this->players), "max" => $this->getMaxPlayers(), "plugins" => $plist]); $this->scheduler->scheduleAsyncTask($this->lastSendUsage); }