diff --git a/resources/config.yml b/resources/config.yml index ed45f4f9..b85f88b5 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -1,6 +1,9 @@ # EssentialsPE configuration # This configuration flie let you modify how EssentialsPE work with some features +# DO NOT EDIT THIS PROPERTY! For internal use ONLY +version: 1.1.0 + # Edit different parts of the AFK feature! afk: # Players that are AFK can, or not, be damaged diff --git a/src/EssentialsPE/Loader.php b/src/EssentialsPE/Loader.php index c1e42718..b302be2f 100644 --- a/src/EssentialsPE/Loader.php +++ b/src/EssentialsPE/Loader.php @@ -267,11 +267,18 @@ private function registerCommands(){ } public function checkConfig(){ - $this->saveDefaultConfig(); + if(!file_exists($this->getDataFolder() . "config.yml")){ + $this->saveDefaultConfig(); + } //$this->saveResource("Economy.yml"); $this->saveResource("Kits.yml"); $cfg = $this->getConfig(); + if(!$cfg->exists("version")){ + unlink($this->getDataFolder() . "config.yml"); + $this->saveDefaultConfig(); + } + $booleans = ["enable-custom-colors"]; foreach($booleans as $key){ $value = null; @@ -334,7 +341,9 @@ public function checkConfig(){ } break; } - $this->getConfig()->setNested("afk." . $key, $value); + if($value !== null){ + $this->getConfig()->setNested("afk." . $key, $value); + } } $updater = ["enabled", "time-interval", "warn-console", "warn-players", "stable"]; @@ -362,7 +371,6 @@ public function checkConfig(){ } $cfg->save(); - $cfg->reload(); } private function saveConfigs(){