Server::getIp() now returns 0.0.0.0 if the IP string is empty

This commit is contained in:
Dylan K. Taylor
2018-05-10 10:25:44 +01:00
parent e7c5d14af3
commit 5e91c05424
3 changed files with 6 additions and 5 deletions

View File

@ -390,7 +390,8 @@ class Server{
* @return string
*/
public function getIp() : string{
return $this->getConfigString("server-ip", "0.0.0.0");
$str = $this->getConfigString("server-ip");
return $str !== "" ? $str : "0.0.0.0";
}
/**
@ -1537,7 +1538,7 @@ class Server{
$this,
$this->getConfigString("rcon.password", ""),
$this->getConfigInt("rcon.port", $this->getPort()),
($ip = $this->getIp()) != "" ? $ip : "0.0.0.0",
$this->getIp(),
$this->getConfigInt("rcon.threads", 1),
$this->getConfigInt("rcon.clients-per-thread", 50)
);
@ -1583,7 +1584,7 @@ class Server{
@cli_set_process_title($this->getName() . " " . $this->getPocketMineVersion());
}
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.networkStart", [$this->getIp() === "" ? "*" : $this->getIp(), $this->getPort()]));
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.networkStart", [$this->getIp(), $this->getPort()]));
define("BOOTUP_RANDOM", random_bytes(16));
$this->serverID = Utils::getMachineUniqueId($this->getIp() . $this->getPort());