diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-06-16 21:41:01 +0100 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-06-16 21:41:01 +0100 |
commit | a818669be013ea7a932551cd062df371fef6babf (patch) | |
tree | ee1c282bbbb516c97cd0523d69a974673a7ac357 | |
parent | e08568de4a24294ef86176fd4dc526c15312402c (diff) | |
download | craftbukkit-a818669be013ea7a932551cd062df371fef6babf.tar craftbukkit-a818669be013ea7a932551cd062df371fef6babf.tar.gz craftbukkit-a818669be013ea7a932551cd062df371fef6babf.tar.lz craftbukkit-a818669be013ea7a932551cd062df371fef6babf.tar.xz craftbukkit-a818669be013ea7a932551cd062df371fef6babf.zip |
When someone moves to Bukkit from a vanilla (or other mod) server, move the old nether folder to the bukkit location. (Yes, it sucks, no, there's no alternative.)
-rw-r--r-- | src/main/java/net/minecraft/server/MinecraftServer.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index e3133073..eaee7e23 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -168,7 +168,36 @@ public class MinecraftServer implements Runnable, ICommandListener { if (j == 0) { world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, dimension, i, org.bukkit.World.Environment.getEnvironment(dimension), null); // CraftBukkit } else { - String name = s + "_" + Environment.getEnvironment(dimension).toString().toLowerCase(); + String worldType = Environment.getEnvironment(dimension).toString().toLowerCase(); + String name = s + "_" + worldType; + String dim = "DIM-1"; + + File newWorld = new File(new File(name), dim); + File oldWorld = new File(new File(s), dim); + + if ((!newWorld.isDirectory()) && (oldWorld.isDirectory())) { + log.info("---- Migration of old " + worldType + " folder required ----"); + log.info("Unfortunately due to the way that Minecraft implemented multiworld support in 1.6, Bukkit requires that you move your " + worldType + " folder to a new location in order to operate correctly."); + log.info("We will move this folder for you, but it will mean that you need to move it back should you wish to stop using Bukkit in the future."); + log.info("Attempting to move " + oldWorld + " to " + newWorld + "..."); + + if (newWorld.exists()) { + log.severe("A file or folder already exists at " + newWorld + "!"); + log.info("---- Migration of old " + worldType + " folder failed ----"); + } else if (newWorld.getParentFile().mkdirs()) { + if (oldWorld.renameTo(newWorld)) { + log.info("Success! To restore the nether in the future, simply move " + newWorld + " to " + oldWorld); + log.info("---- Migration of old " + worldType + " folder complete ----"); + } else { + log.severe("Could not move folder " + oldWorld + " to " + newWorld + "!"); + log.info("---- Migration of old " + worldType + " folder failed ----"); + } + } else { + log.severe("Could not create path for " + newWorld + "!"); + log.info("---- Migration of old " + worldType + " folder failed ----"); + } + } + world = new SecondaryWorldServer(this, new ServerNBTManager(new File("."), name, true), name, dimension, i, worlds.get(0), org.bukkit.World.Environment.getEnvironment(dimension), null); // CraftBukkit } |