Hi. How can I delete whole world (way is /worlds/myworld)/config file of plugin (plugin is named WorldManager, so way is /plugins/WorldManager/config.yml) or copy(/plugins/WorldManager/backup.yml)/ (/worlds/myworld_backup) to same folder with name (config.yml)/( myworld)? It's good for some minigames plugins.
https://github.com/PEMapModder/Legi.../src/legionpe/theta/utils/MUtils.php#L103-131 Spoiler: Bad practice! Don't read, it harms your health! Also, if you found these functions too unstable or don't want to use them, you can use system dependent functions (highly discouraged for public plugins). For Mac and Linux: PHP: exec("rm -r " . $Server->getDataPath() . "worlds/" . $world_name ); For Widnows: PHP: exec("del " . $Server->getDataPath() . "worlds/" . $world_name ); But be warned that this is bad practice, so...
Moral of the story: When writing code, lock your room door and do not invite @PEMapModder with his pet dinosaur.
Method I use from my SG plugin: PHP: public function delete_dir($folder) { $glob = glob($folder); foreach($glob as $g){ if(!is_dir($g)){ @unlink($g); }else{ $this->delete_dir("$g/*"); @rmdir($g); } }}public function recurse_copy($src, $dst) { $dir = opendir($src); @mkdir($dst); while(false !== ($file = readdir($dir))){ if(($file != '.') && ($file != '..')){ if(is_dir($src . '/' . $file)){ $this->recurse_copy($src . '/' . $file,$dst . '/' . $file); }else{ copy($src . '/' . $file,$dst . '/' . $file); } } }closedir($dir);}