With a pocketmine function how to copy a world ( exemple : copyworld ) and rename the copy with a custom name ( like "worldA") i need it in a function for a plugin. Like as onPlayerJoin....the plugins create a copy of the patern world and rename the copy with the player name. Can someone help me ?
Filesystem-related functions aren't related to PocketMine at all. PHP: function recursive_copyDir($from, $to){ @mkdir($to, 0777, true); $from = rtrim($from, "/\\") . DIRECTORY_SEPARATOR; $to = rtrim($to, "/\\") . DIRECTORY_SEPARATOR; $dir = dir($from); while(($f = $dir->read()) !== false){ $file = $from . $f; $toFile = $to . $f; if(is_dir($file)){ recursive_copyDir($file, $toFile); }else{ copy($file, $toFile); } }}
Unload it, create an NBT object, tell NBT to read level.dat using $nbt->readCompressed(), modify values inside it, reload level.