diff --git a/src/API/ServerAPI.php b/src/API/ServerAPI.php index edffeb1fd..642600cc1 100644 --- a/src/API/ServerAPI.php +++ b/src/API/ServerAPI.php @@ -295,7 +295,6 @@ class ServerAPI{ $this->server->gamemode = $this->getProperty("gamemode"); $this->server->difficulty = $this->getProperty("difficulty"); $this->server->whitelist = $this->getProperty("white-list"); - $this->server->reloadConfig(); } } diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index 8dfef02ea..5f2ab749b 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -36,7 +36,7 @@ class PocketMinecraftServer{ }*/ console("[INFO] Starting Minecraft PE server on ".($this->serverip === "0.0.0.0" ? "*":$this->serverip).":".$this->port); define("BOOTUP_RANDOM", Utils::getRandomBytes(16)); - $this->serverID = $this->serverID === false ? Utils::readLong(Utils::getRandomBytes(8, false)):$this->serverID; + $this->serverID = $this->serverID === false ? Utils::readLong(substr(Utils::getUniqueID(true), 8)):$this->serverID; $this->seed = $this->seed === false ? Utils::readInt(Utils::getRandomBytes(4, false)):$this->seed; $this->startDatabase(); $this->api = false; @@ -65,7 +65,6 @@ class PocketMinecraftServer{ $this->tickMeasure = array_fill(0, 40, 0); $this->setType("normal"); $this->interface = new MinecraftInterface($this, "255.255.255.255", $this->port, true, false, $this->serverip); - $this->reloadConfig(); $this->stop = false; $this->ticks = 0; if(!defined("NO_THREADS")){ @@ -157,10 +156,6 @@ class PocketMinecraftServer{ return $result; } - public function reloadConfig(){ - - } - public function debugInfo($console = false){ $info = array(); $info["tps"] = $this->getTPS(); diff --git a/src/utils/Utils.php b/src/utils/Utils.php index 3f08a5cca..8836d0160 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -31,6 +31,32 @@ class Utils{ return ((@fsockopen("google.com", 80, $e = null, $n = null, 2) !== false or @fsockopen("www.linux.org", 80, $e = null, $n = null, 2) !== false or @fsockopen("www.php.net", 80, $e = null, $n = null, 2) !== false) ? true:false); } + public static function getUniqueID($raw = false){ + $machine = php_uname("a"); + $machine .= file_exists("/proc/cpuinfo") ? file_get_contents("/proc/cpuinfo") : ""; + $machine .= sys_get_temp_dir(); + if(Utils::getOS() == "win"){ + exec("ipconfig /ALL", $mac); + $mac = implode("\n", $mac); + if(preg_match_all("#Physical Address[. ]{1,}: ([0-9A-F\-]{17})#", $mac, $matches)){ + foreach($matches[1] as $i => $v){ + if($v == "00-00-00-00-00-00"){ + unset($matches[1][$i]); + } + } + $machine .= implode(" ", $matches[1]); //Mac Addresses + } + } + $data = $machine . PHP_MAXPATHLEN; + $data .= PHP_INT_MAX; + $data .= PHP_INT_SIZE; + $data .= get_current_user(); + foreach(get_loaded_extensions() as $ext){ + $data .= $ext.":".phpversion($ext); + } + return hash("md5", $machine, $raw).hash("sha512", $data, $raw); + } + public static function getIP($force = false){ if(Utils::$online === false){ return false;