mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Isolate config casting nastiness in one place
this doesn't solve the underlying problem, but it does reduce the amount of noise made by PHPStan about it, as well as avoiding code litter.
This commit is contained in:
@ -55,7 +55,7 @@ class AutoUpdater{
|
||||
$this->logger = new \PrefixedLogger($server->getLogger(), "Auto Updater");
|
||||
$this->endpoint = "http://$endpoint/api/";
|
||||
|
||||
if((bool) $server->getConfigGroup()->getProperty("auto-updater.enabled", true)){
|
||||
if($server->getConfigGroup()->getPropertyBool("auto-updater.enabled", true)){
|
||||
$this->doCheck();
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,7 @@ class AutoUpdater{
|
||||
$this->checkUpdate();
|
||||
if($this->hasUpdate()){
|
||||
(new UpdateNotifyEvent($this))->call();
|
||||
if((bool) $this->server->getConfigGroup()->getProperty("auto-updater.on-update.warn-console", true)){
|
||||
if($this->server->getConfigGroup()->getPropertyBool("auto-updater.on-update.warn-console", true)){
|
||||
$this->showConsoleUpdate();
|
||||
}
|
||||
}else{
|
||||
@ -178,7 +178,7 @@ class AutoUpdater{
|
||||
* Returns the channel used for update checking (stable, beta, dev)
|
||||
*/
|
||||
public function getChannel() : string{
|
||||
$channel = strtolower($this->server->getConfigGroup()->getProperty("auto-updater.preferred-channel", "stable"));
|
||||
$channel = strtolower($this->server->getConfigGroup()->getPropertyString("auto-updater.preferred-channel", "stable"));
|
||||
if($channel !== "stable" and $channel !== "beta" and $channel !== "alpha" and $channel !== "development"){
|
||||
$channel = "stable";
|
||||
}
|
||||
|
Reference in New Issue
Block a user