I am trying to copy and paste a Minecraft World from a template into the server folder and then load the world. I am getting this error:
java.io.FileNotFoundException: .\C:\Users\Archie\Desktop\Server.b571c7a6-3297-48eb-ac24-1bac65ef9727\session.lock (The filename, directory name, or volume label syntax is incorrect)
So here is what I tried:
Printing out the source of the path and then the place I am copying it to, to console to check it is the correct path, here is what was printed:
C:\Users\Archie\Desktop\Server.b571c7a6-3297-48eb-ac24-1bac65ef9727 (dir to copy to)
C:\Users\Archie\Desktop\Server\plugins\Solus\gameworld (src)
That is correct. And in that folder the session.lock is literally there: http://prntscr.com/klc7xp
So I am really confused as to why it is throwing a file not found exception, I've googled it but there doesn't really seem to be a fix.
Here is the code:
private void loadWorld() {
File game = new File(Solus.get().getServer().getWorldContainer().getAbsolutePath() + uuid.toString());
if (!game.mkdir()) {
System.out.println("Couldn't generate the game: " + uuid.toString());
}
File srcDir = new File(Solus.get().getDataFolder().getAbsolutePath() + File.separator + "gameworld");
System.out.println(game.getPath() + " : " + srcDir.getAbsolutePath());
try {
FileUtils.copyDirectory(srcDir, game);
} catch (IOException e) {
e.printStackTrace();
}
WorldCreator wc = new WorldCreator(game.getAbsolutePath());
wc.createWorld();
this.world = Bukkit.getServer().createWorld(wc);
}
Code explanation:
- Creates the folder to store the world data inside.
- Creates the folder.
- Finds the gameworld file that needs to be copied and replicated.
- Copies the folder into the directory created earlier.
- ( Spigot ) Loads the world.