summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
authorEvilSeph <evilseph@gmail.com>2012-11-02 20:51:14 -0400
committerEvilSeph <evilseph@gmail.com>2012-11-02 21:12:02 -0400
commitf683d5568ff6ab75809b463771a15c23863b8f39 (patch)
treeca4c853c9dc3a9e268c0444a3c462ca227f80087 /src/main/java/net
parent53d24e2b22c29b2ae0ab96af4855d932b8428454 (diff)
downloadcraftbukkit-f683d5568ff6ab75809b463771a15c23863b8f39.tar
craftbukkit-f683d5568ff6ab75809b463771a15c23863b8f39.tar.gz
craftbukkit-f683d5568ff6ab75809b463771a15c23863b8f39.tar.lz
craftbukkit-f683d5568ff6ab75809b463771a15c23863b8f39.tar.xz
craftbukkit-f683d5568ff6ab75809b463771a15c23863b8f39.zip
Migrate world data with world when switching from vanilla Minecraft to
Bukkit. Fixes BUKKIT-2816 and BUKKIT-2760
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/MinecraftServer.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index dd2d741d..f797565d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -14,6 +14,9 @@ import java.util.logging.Logger;
// CraftBukkit start
import java.util.concurrent.ExecutionException;
+import java.io.IOException;
+
+import com.google.common.io.Files;
import jline.console.ConsoleReader;
import joptsimple.OptionSet;
@@ -213,6 +216,12 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC
} else if (newWorld.getParentFile().mkdirs()) {
if (oldWorld.renameTo(newWorld)) {
log.info("Success! To restore " + worldType + " in the future, simply move " + newWorld + " to " + oldWorld);
+ // Migrate world data too.
+ try {
+ Files.copy(new File(new File(s), "level.dat"), new File(new File(name), "level.dat"));
+ } catch (IOException exception) {
+ log.severe("Unable to migrate world data.");
+ }
log.info("---- Migration of old " + worldType + " folder complete ----");
} else {
log.severe("Could not move folder " + oldWorld + " to " + newWorld + "!");