My goal is to use setAll() to set the default config values if the config isn't found, but it doesn't work. PHP: if(!file_exists(($path = $d . 'config.yml'))){ // config file $c = new Config($path, Config::YAML); $c->setAll(['Economy-Plugin' => 'EconomyAPI', 'Broadcast' => ['example1'], 'Border' => 500, 'AntiSpam-Delay' => 2.5, 'Staff(s)' => ['homelyangel'], 'Banned-Stuff' => [ 'Words' => ['a_badword_example'], 'Items' => [7] ], 'Prefix' => ' Help me' ]); $c->save(); }
Try add the array into the constructor. PHP: $data = ['Economy-Plugin' => 'EconomyAPI', 'Broadcast' => ['example1'], 'Border' => 500, 'AntiSpam-Delay' => 2.5, 'Staff(s)' => ['homelyangel'], 'Banned-Stuff' => [ 'Words' => ['a_badword_example'], 'Items' => [7] ], 'Prefix' => ' Help me' ];$config = new Config($path, Config::YAML, $data);
I found my error , so in my Main class i was trying to get the 'Prefix' value even before it was created so it just created a blank config , i put the line under the function where i start this function and it worked.