Improved unique id generation for server

This commit is contained in:
Shoghi Cervantes
2015-05-21 12:59:33 +02:00
parent cde2d39029
commit 46f20d36b3
4 changed files with 44 additions and 12 deletions

View File

@@ -346,6 +346,10 @@ class Server{
return $this->getConfigString("motd", "Minecraft: PE Server");
}
public function getServerUniqueId(){
return $this->serverID;
}
/**
* @return bool
*/
@@ -1638,7 +1642,10 @@ class Server{
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.networkStart", [$this->getIp() === "" ? "*" : $this->getIp(), $this->getPort()]));
define("BOOTUP_RANDOM", @Utils::getRandomBytes(16));
$this->serverID = Utils::getServerUniqueId($this->getIp() . $this->getPort());
$this->serverID = Utils::getMachineUniqueId($this->getIp() . $this->getPort());
$this->getLogger()->debug("Server unique id: " . $this->getServerUniqueId());
$this->getLogger()->debug("Machine unique id: " . Utils::getMachineUniqueId());
$this->network = new Network($this);
$this->network->setName($this->getMotd());