Skip to content

Commit

Permalink
Cast player list to array when formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
samerton committed Dec 30, 2020
1 parent df97b63 commit 9783ce4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/classes/MCQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static function singleQuery($ip = null, $type = 'internal', $language, $q
'player_count' => Output::getClean($query->response->players->online),
'player_count_max' => Output::getClean($query->response->players->max),
'player_list' => $player_list,
'format_player_list' => self::formatPlayerList($player_list),
'format_player_list' => self::formatPlayerList((array)$player_list),
'x_players_online' => str_replace('{x}', Output::getClean($query->response->players->online), $language->get('general', 'currently_x_players_online')),
'motd' => $query->response->description->text
);
Expand Down Expand Up @@ -279,6 +279,7 @@ private static function formatPlayerList($player_list) {

if (count($player_list)) {
foreach ($player_list as $player) {
$player = (array)$player;
$user = new User($player['id'], 'uuid');
if (!$user->data()) {
$user = new User($player['name'], 'username');
Expand Down

0 comments on commit 9783ce4

Please sign in to comment.