public function onRun() { $query = new MinecraftQuery(); foreach ($this->targets as $target) { $address = explode(":", $target); $query->connect($address[0], $address[1]); $this->data[] = $query->getInfo(); } }
public function onRun() { $data = []; $query = new MinecraftQuery(); foreach ($this->targets as $target) { $address = explode(":", $target); try { $query->connect($address[0], isset($address[1]) ? $address[1] : 19132); $data[] = ["info" => $query->getInfo()]; //var_dump($query->getInfo()); //var_dump($query->getPlayers()); } catch (MinecraftQueryException $exception) { $data[] = $exception->getMessage(); } } $this->result = $data; }