From bbc1df9b0fbaf73a6cd613b3aa82aec142e584e0 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Wed, 12 Dec 2012 01:23:06 +0100 Subject: [PATCH] Fixed whitelist enabled by bug --- classes/API/ServerAPI.php | 11 +++++------ common/default.properties | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/classes/API/ServerAPI.php b/classes/API/ServerAPI.php index 725748759..914e8f938 100644 --- a/classes/API/ServerAPI.php +++ b/classes/API/ServerAPI.php @@ -60,8 +60,8 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run if($this->getProperty("last-update") === false or ($this->getProperty("last-update") + 3600) < time()){ console("[INFO] Checking for new version..."); $info = json_decode(Utils::curl_get("https://api.github.com/repos/shoghicp/Pocket-Minecraft-PHP"), true); - $last = date_parse($info["updated_at"]); - $last = mktime($last["hour"], $last["minute"], $last["second"], $last["month"], $last["day"], $last["year"]); + $last = new DateTime($info["updated_at"]); + $last = $last->getTimestamp(); if($last >= $this->getProperty("last-update") and $this->getProperty("last-update") !== false){ console("[NOTICE] Pocket-PHP-Minecraft has been updated at ".date("Y-m-d H:i:s", $last)); console("[NOTICE] If you want to update, download the latest version at https://github.com/shoghicp/Pocket-Minecraft-PHP/archive/master.zip"); @@ -192,10 +192,10 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run $this->config["seed"] = $this->server->seed; $this->config["server-id"] = $this->server->serverID; } - $this->config["regenerate-config"] = "false"; - $this->config["white-list"] = $this->config["white-list"] === true ? "true":"false"; + $config = $this->config; + $config["white-list"] = $config["white-list"] === true ? "true":"false"; $prop = "#Pocket Minecraft PHP server properties\r\n#".date("D M j H:i:s T Y")."\r\n"; - foreach($this->config as $n => $v){ + foreach($config as $n => $v){ if($n == "spawn"){ $v = implode(";", $v); } @@ -250,7 +250,6 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run $v = array("x" => floatval($v[0]), "y" => floatval($v[1]), "z" => floatval($v[2])); break; case "white-list": - case "regenerate-config": $v = trim($v) == "true" ? true:false; break; } diff --git a/common/default.properties b/common/default.properties index 053e57975..c22d763d8 100644 --- a/common/default.properties +++ b/common/default.properties @@ -15,5 +15,4 @@ difficulty=1 seed=false level-name=false server-id=false -spawn=128.5;100;128.5 -regenerate-config=true \ No newline at end of file +spawn=128.5;100;128.5 \ No newline at end of file