Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Migrate world data with world when switching from vanilla Minecraft to
Bukkit. Fixes BUKKIT-2816 and BUKKIT-2760
Dieser Commit ist enthalten in:
Ursprung
53d24e2b22
Commit
f683d5568f
@ -14,6 +14,9 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.google.common.io.Files;
|
||||||
import jline.console.ConsoleReader;
|
import jline.console.ConsoleReader;
|
||||||
import joptsimple.OptionSet;
|
import joptsimple.OptionSet;
|
||||||
|
|
||||||
@ -213,6 +216,12 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC
|
|||||||
} else if (newWorld.getParentFile().mkdirs()) {
|
} else if (newWorld.getParentFile().mkdirs()) {
|
||||||
if (oldWorld.renameTo(newWorld)) {
|
if (oldWorld.renameTo(newWorld)) {
|
||||||
log.info("Success! To restore " + worldType + " in the future, simply move " + newWorld + " to " + oldWorld);
|
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 ----");
|
log.info("---- Migration of old " + worldType + " folder complete ----");
|
||||||
} else {
|
} else {
|
||||||
log.severe("Could not move folder " + oldWorld + " to " + newWorld + "!");
|
log.severe("Could not move folder " + oldWorld + " to " + newWorld + "!");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren