Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void copyWorld(File source, File target) {
- /*try {
- ArrayList<String> ignore = new ArrayList<String>(Arrays.asList("uid.dat", "session.dat"));
- if (!ignore.contains(source.getName())) {
- if (source.isDirectory()) {
- Bukkit.unloadWorld(source.getName(), false);
- if (!target.exists())
- target.mkdirs();
- String files[] = source.list();
- for (String file : files) {
- File srcFile = new File(source, file);
- File destFile = new File(target, file);
- copyWorld(srcFile, destFile);
- }
- } else {
- InputStream in = new FileInputStream(source);
- if (!target.exists())
- target.createNewFile();
- OutputStream out = new FileOutputStream(target);
- byte[] buffer = new byte[1024];
- int length;
- while ((length = in.read(buffer)) > 0)
- out.write(buffer, 0, length);
- in.close();
- out.close();
- }
- }
- } catch (IOException e) {
- e.printStackTrace();
- }*/
- // Unload the source world world
- System.out.println(source.canWrite());
- System.out.println(source.canWrite());
- Bukkit.unloadWorld(source.getName(), true);
- FileUtil.copy(source, target);
- }
Advertisement
Add Comment
Please, Sign In to add comment