how to copy a world in spigot code example
Example 1: spigot world copy
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) { }}
Example 2: spigot world copy