Hello, I’m working on a BedWars pratice server and I was wondering how to get a world for instance the world is “Bridge” and I want to copy it and paste it so when players play the practice gamemode it can copy the world and the player gets teleported to the copied world, when they leave the world automatically deletes.
PHP: <?phppublic function recursive_copy($src,$dst) { $dir = opendir($src); @mkdir($dst); while(( $file = readdir($dir)) ) { if (( $file != '.' ) && ( $file != '..' )) { if ( is_dir($src . '/' . $file) ) { $this->recursive_copy($src .'/'. $file, $dst .'/'. $file); } else { copy($src .'/'. $file,$dst .'/'. $file); } } } closedir($dir);}$this->recursive_copy("world_name", "folder_worlds");
PHP: $level = $this->getServer()->getLevelByNaame("WolrdYourCopyName");$player->teleport($level->getSafeSpawn());