0
Q:

spigot world copy

 copyWorld(sourceFolder, targetFolder); 
0
 // The world to copyWorld source = Bukkit.getWorld("world");File sourceFolder = source.getWorldFolder(); // The world to overwrite when copyingWorld target = Bukkit.getWorld("NewWorld");File targetFolder = target.getWorldFolder(); 
0
 public 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()) {                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);                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) {     }} 
0

New to Communities?

Join the community