my files in plugin resources folder: arenas/default.yml PHP: if(!is_file($this->getDataFolder()."arenas/default.yml")){ fopen($this->getDataFolder()."arenas/default.yml", "w"); file_put_contents($this->getDataFolder()."arenas/default.yml", $this->getResource("arenas/default.yml")); } Spoiler: error message Code: [CRITICAL] Could not save Config C:\Users\Honza\Documents\PocketMine-MP\plugins\ColorMatch/arenas/C:\Users\Honza\Documents\PocketMine-MP\plugins\ColorMatch/arenas/default.yml: file_put_contents(C:\Users\Honza\Documents\PocketMine-MP\plugins\ColorMatch/arenas/C:\Users\Honza\Documents\PocketMine-MP\plugins\ColorMatch/arenas/default.yml): failed to open stream: Invalid argument
Remove the everything in the if statement and replace it with PHP: $this->saveResource("arenas/default.yml"); You may also need to create the "arenas" directory in your data folder, I am not sure.
maybe problem was in this method: PHP: public function checkArenas(){ $this->getLogger()->info("checking arena files..."); foreach(glob($this->getDataFolder()."arenas/*.yml") as $file){ $arena = new Config($file, Config::YAML); if($this->checkFile($arena)){ $last = strrpos($file,'.')+1; $pripona = ($last > 1) ? substr($file, $last) : false; $this->setArenasData($arena, $pripona); $this->getLogger()->info("$file checking sucessful"); } else{ $this->getLogger()->critical("$file is not setup properly"); return; } } } i used PHP: new Config($this->getDataFolder()."arenas/".$file, Config::YAML);
It is pointless to call fopen() if you don't use the return value as a stream to write/read to the file with.