GameQ icon indicating copy to clipboard operation
GameQ copied to clipboard

Terraria: Undefined propery when server does not return player list

Open RikoDEV opened this issue 2 years ago • 0 comments

Server: penguingames.fun:7777

{
  "status": 200,
  "name": "Penguin Games",
  "serverversion": "1.4.4.9 (PC/Mobile)",
  "tshockversion": "4.4.0.15",
  "port": 7777,
  "playercount": 54,
  "maxplayers": 99999,
  "world": "Penguin Games",
  "uptime": "6.14:41:30",
  "serverpassword": false
}

Error:

  Undefined property: stdClass::$players

  at vendor\austinb\gameq\src\GameQ\Protocols\Tshock.php:132
    128▕         $result->add('numplayers', $json->playercount);
    129▕         $result->add('maxplayers', $json->maxplayers);
    130▕
    131▕         // Parse players
  ➜ 132▕         foreach ($json->players as $player) {
    133▕             $result->addPlayer('nickname', $player->nickname);
    134▕             $result->addPlayer('username', $player->username);
    135▕             $result->addPlayer('group', $player->group);
    136▕             $result->addPlayer('active', (int)$player->active);

  1   vendor\austinb\gameq\src\GameQ\Protocols\Tshock.php:132
      Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap\{closure}("Undefined property: stdClass::$players", "C:\Users\user\PhpstormProjects\project\vendor\austinb\gameq\src\GameQ\Protocols\Tshock.php")

  2   vendor\austinb\gameq\src\GameQ\GameQ.php:595
      GameQ\Protocols\Tshock::processResponse()

RikoDEV avatar Jul 15 '23 14:07 RikoDEV