Skip to content

Commit

Permalink
Merge 8eeee6f into 4d0c780
Browse files Browse the repository at this point in the history
  • Loading branch information
ldilley committed Sep 11, 2021
2 parents 4d0c780 + 8eeee6f commit b26787b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion PHP/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fragland/minestat",
"version": "2.2.0",
"version": "2.2.1",
"type": "library",
"description": "A Minecraft server status checker",
"keywords": ["Minecraft","status"],
Expand Down
21 changes: 14 additions & 7 deletions PHP/minestat.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class MineStat
{
const VERSION = "2.2.0"; // MineStat version
const VERSION = "2.2.1"; // MineStat version
const NUM_FIELDS = 6; // number of values expected from server
const NUM_FIELDS_BETA = 3; // number of values expected from a 1.8b/1.3 server
const MAX_VARINT_SIZE = 5; // maximum number of bytes a varint can be
Expand Down Expand Up @@ -124,14 +124,21 @@ private function strip_motd($is_json = false)
$this->stripped_motd = preg_replace("/§./", "", $this->motd);
else
{
$this->stripped_motd = $this->motd['text'];
$json_data = $this->motd['extra'];
if(!empty($json_data))
if(isset($this->motd['text']))
$this->stripped_motd = $this->motd['text'];
else
$this->stripped_motd = $this->motd;
if(isset($this->motd['extra']))
{
foreach($json_data as &$nested_hash)
$this->stripped_motd .= $nested_hash['text'];
$json_data = $this->motd['extra'];
if(!empty($json_data))
{
foreach($json_data as &$nested_hash)
$this->stripped_motd .= $nested_hash['text'];
}
}
$this->motd = json_encode($this->motd);
if(is_array($this->motd))
$this->motd = json_encode($this->motd);
$this->stripped_motd = preg_replace("/§./", "", $this->stripped_motd);
}
}
Expand Down

0 comments on commit b26787b

Please sign in to comment.