diff --git a/src/pocketmine/Achievement.php b/src/pocketmine/Achievement.php index 54ce474f8..273ed5803 100644 --- a/src/pocketmine/Achievement.php +++ b/src/pocketmine/Achievement.php @@ -116,7 +116,7 @@ abstract class Achievement{ public static function broadcast(Player $player, string $achievementId) : bool{ if(isset(Achievement::$list[$achievementId])){ $translation = new TranslationContainer("chat.type.achievement", [$player->getDisplayName(), TextFormat::GREEN . Achievement::$list[$achievementId]["name"] . TextFormat::RESET]); - if(Server::getInstance()->getConfigBoolean("announce-player-achievements", true) === true){ + if(Server::getInstance()->getConfigBool("announce-player-achievements", true) === true){ Server::getInstance()->broadcastMessage($translation); }else{ $player->sendMessage($translation); diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 336e23aa8..db7b96cc0 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2404,7 +2404,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ } $cancelled = false; - if($target instanceof Player and $this->server->getConfigBoolean("pvp", true) === false){ + if($target instanceof Player and $this->server->getConfigBool("pvp", true) === false){ $cancelled = true; } @@ -2419,7 +2419,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ }elseif($target instanceof Player){ if(($target->getGamemode() & 0x01) > 0){ return true; - }elseif($this->server->getConfigBoolean("pvp") !== true){ + }elseif($this->server->getConfigBool("pvp") !== true){ $cancelled = true; } diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 75ee9bd72..f4468b531 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -428,7 +428,7 @@ class Server{ * @return bool */ public function getGenerateStructures() : bool{ - return $this->getConfigBoolean("generate-structures", true); + return $this->getConfigBool("generate-structures", true); } /** @@ -442,7 +442,7 @@ class Server{ * @return bool */ public function getForceGamemode() : bool{ - return $this->getConfigBoolean("force-gamemode", false); + return $this->getConfigBool("force-gamemode", false); } /** @@ -537,7 +537,7 @@ class Server{ * @return bool */ public function hasWhitelist() : bool{ - return $this->getConfigBoolean("white-list", false); + return $this->getConfigBool("white-list", false); } /** @@ -551,14 +551,14 @@ class Server{ * @return bool */ public function getAllowFlight() : bool{ - return $this->getConfigBoolean("allow-flight", false); + return $this->getConfigBool("allow-flight", false); } /** * @return bool */ public function isHardcore() : bool{ - return $this->getConfigBoolean("hardcore", false); + return $this->getConfigBool("hardcore", false); } /** @@ -1234,7 +1234,7 @@ class Server{ * * @return bool */ - public function getConfigBoolean(string $variable, bool $defaultValue = false) : bool{ + public function getConfigBool(string $variable, bool $defaultValue = false) : bool{ $v = getopt("", ["$variable::"]); if(isset($v[$variable])){ $value = $v[$variable]; @@ -1256,6 +1256,18 @@ class Server{ return false; } + /** + * @deprecated + * + * @param string $variable + * @param bool $defaultValue + * + * @return bool + */ + public function getConfigBoolean(string $variable, bool $defaultValue = false) : bool{ + return $this->getConfigBool($variable, $defaultValue); + } + /** * @param string $variable * @param bool $value @@ -1528,7 +1540,7 @@ class Server{ $this->scheduler = new ServerScheduler(); - if($this->getConfigBoolean("enable-rcon", false) === true){ + if($this->getConfigBool("enable-rcon", false) === true){ try{ $this->rcon = new RCON( $this, @@ -1560,9 +1572,9 @@ class Server{ $this->banByIP->load(); $this->maxPlayers = $this->getConfigInt("max-players", 20); - $this->setAutoSave($this->getConfigBoolean("auto-save", true)); + $this->setAutoSave($this->getConfigBool("auto-save", true)); - $this->onlineMode = $this->getConfigBoolean("xbox-auth", true); + $this->onlineMode = $this->getConfigBool("xbox-auth", true); if($this->onlineMode){ $this->logger->notice($this->getLanguage()->translateString("pocketmine.server.auth", ["enabled", "will"])); $this->logger->notice($this->getLanguage()->translateString("pocketmine.server.authProperty", ["disable", "false"])); @@ -1572,7 +1584,7 @@ class Server{ $this->logger->warning($this->getLanguage()->translateString("pocketmine.server.authProperty", ["enable", "true"])); } - if($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < Level::DIFFICULTY_HARD){ + if($this->getConfigBool("hardcore", false) === true and $this->getDifficulty() < Level::DIFFICULTY_HARD){ $this->setConfigInt("difficulty", Level::DIFFICULTY_HARD); } @@ -1992,7 +2004,7 @@ class Server{ $this->properties->reload(); $this->maxPlayers = $this->getConfigInt("max-players", 20); - if($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < Level::DIFFICULTY_HARD){ + if($this->getConfigBool("hardcore", false) === true and $this->getDifficulty() < Level::DIFFICULTY_HARD){ $this->setConfigInt("difficulty", Level::DIFFICULTY_HARD); } @@ -2100,7 +2112,7 @@ class Server{ * Starts the PocketMine-MP server and starts processing ticks and packets */ public function start(){ - if($this->getConfigBoolean("enable-query", true) === true){ + if($this->getConfigBool("enable-query", true) === true){ $this->queryHandler = new QueryHandler(); }