Since I'm not that advanced, could you give me a summary or explanation on how I would implement that into the ScoreHud addon ?
@amirTBM I finished the addon (almost all of the code credit goes to @jasonwynn10 ) You can edit it to your needs: PHP: <?phpdeclare(strict_types = 1);/** * @name Servers * @version 1.0.0 * @main JackMD\ScoreHud\Addons\Servers */namespace JackMD\ScoreHud\Addons{ use libpmquery\PMQuery; use libpmquery\PmQueryException; use JackMD\ScoreHud\addon\AddonBase; use pocketmine\Player; use pocketmine\utils\Internet; use pocketmine\Server; use pocketmine\scheduler\AsyncTask; use pocketmine\scheduler\BulkCurlTask; use pocketmine\utils\InternetException; use pocketmine\utils\TextFormat; class Servers extends AddonBase{ public $data = []; private $queryServer; private $host = "149.28.224.203"; private $port = 30000; private $timeout = 4; public function getProcessedTags(Player $player): array{ $socket = @fsockopen('udp://'."149.28.224.203", 30000, $errno, $errstr, 4); if($errno) { fclose($socket); throw new PmQueryException($errstr, $errno); }elseif($socket === false) { throw new PmQueryException($errstr, $errno); } stream_Set_Timeout($socket, 4); stream_Set_Blocking($socket, true); // hardcoded magic https://github.com/facebookarchive/RakNet/blob/1a169895a900c9fc4841c556e16514182b75faf8/Source/RakPeer.cpp#L135 $OFFLINE_MESSAGE_DATA_ID = \pack('c*', 0x00, 0xFF, 0xFF, 0x00, 0xFE, 0xFE, 0xFE, 0xFE, 0xFD, 0xFD, 0xFD, 0xFD, 0x12, 0x34, 0x56, 0x78); $command = \pack('cQ', 0x01, time()); // DefaultMessageIDTypes::ID_UNCONNECTED_PING + 64bit current time $command .= $OFFLINE_MESSAGE_DATA_ID; $command .= \pack('Q', 2); // 64bit guid $length = \strlen($command); if($length !== fwrite($socket, $command, $length)) { throw new PmQueryException("Failed to write on socket.", E_WARNING); } $data = fread($socket, 4096); fclose($socket); if(empty($data) or $data === false) { throw new PmQueryException("Server failed to respond", E_WARNING); } if(substr($data, 0, 1) !== "\x1C") { throw new PmQueryException("First byte is not ID_UNCONNECTED_PONG.", E_WARNING); } if(substr($data, 17, 16) !== $OFFLINE_MESSAGE_DATA_ID) { throw new PmQueryException("Magic bytes do not match."); } // TODO: What are the 2 bytes after the magic? $data = \substr($data, 35); // TODO: If server-name contains a ';' it is not escaped, and will break this parsing $data = \explode(';', $data); return [ "{GameName}" => $data[0], "{HostName}" => $data[1], "{Protocol}" => $data[2], "{Version}" => $data[3], "{Players}" => $data[4], "{MaxPlayers}" => $data[5], "{Unknown2}" => $data[6], // TODO: What is this? "{Map}" => $data[7], "{GameMode}" => $data[8], "{Unknown3}" => $data[9], // TODO: What is this? ]; } }} Sorry I basically stole the code jasonwynn10, but it wouldn't let me use your class externally as a ScoreHud addon so I had to put it in....