Archiviert
13
0

SPIGOT-1283: Copy data directory on world import in case it's required

Dieser Commit ist enthalten in:
md_5 2016-06-30 15:13:32 +10:00
Ursprung 6470560480
Commit 1faaa340e5

Datei anzeigen

@ -109,7 +109,7 @@
this.i = new long[this.worldServer.length][100]; this.i = new long[this.worldServer.length][100];
IDataManager idatamanager = this.convertable.a(s, true); IDataManager idatamanager = this.convertable.a(s, true);
@@ -167,36 +221,107 @@ @@ -167,36 +221,108 @@
worlddata.a(s1); worlddata.a(s1);
worldsettings = new WorldSettings(worlddata); worldsettings = new WorldSettings(worlddata);
} }
@ -187,6 +187,7 @@
+ // Migrate world data too. + // Migrate world data too.
+ try { + try {
+ com.google.common.io.Files.copy(new File(new File(s), "level.dat"), new File(new File(name), "level.dat")); + com.google.common.io.Files.copy(new File(new File(s), "level.dat"), new File(new File(name), "level.dat"));
+ org.apache.commons.io.FileUtils.copyDirectory(new File(new File(s), "data"), new File(new File(name), "data"));
+ } catch (IOException exception) { + } catch (IOException exception) {
+ MinecraftServer.LOGGER.warn("Unable to migrate world data."); + MinecraftServer.LOGGER.warn("Unable to migrate world data.");
+ } + }
@ -228,7 +229,7 @@
this.v.setPlayerFileData(this.worldServer); this.v.setPlayerFileData(this.worldServer);
this.a(this.getDifficulty()); this.a(this.getDifficulty());
this.l(); this.l();
@@ -212,25 +337,38 @@ @@ -212,25 +338,38 @@
this.b("menu.generatingTerrain"); this.b("menu.generatingTerrain");
boolean flag4 = false; boolean flag4 = false;
@ -282,7 +283,7 @@
this.t(); this.t();
} }
@@ -266,14 +404,17 @@ @@ -266,14 +405,17 @@
protected void t() { protected void t() {
this.f = null; this.f = null;
this.g = 0; this.g = 0;
@ -302,7 +303,7 @@
if (worldserver != null) { if (worldserver != null) {
if (!flag) { if (!flag) {
@@ -282,6 +423,7 @@ @@ -282,6 +424,7 @@
try { try {
worldserver.save(true, (IProgressUpdate) null); worldserver.save(true, (IProgressUpdate) null);
@ -310,7 +311,7 @@
} catch (ExceptionWorldConflict exceptionworldconflict) { } catch (ExceptionWorldConflict exceptionworldconflict) {
MinecraftServer.LOGGER.warn(exceptionworldconflict.getMessage()); MinecraftServer.LOGGER.warn(exceptionworldconflict.getMessage());
} }
@@ -290,8 +432,24 @@ @@ -290,8 +433,24 @@
} }
@ -336,7 +337,7 @@
if (this.am() != null) { if (this.am() != null) {
this.am().b(); this.am().b();
} }
@@ -300,6 +458,7 @@ @@ -300,6 +459,7 @@
MinecraftServer.LOGGER.info("Saving players"); MinecraftServer.LOGGER.info("Saving players");
this.v.savePlayers(); this.v.savePlayers();
this.v.u(); this.v.u();
@ -344,7 +345,7 @@
} }
if (this.worldServer != null) { if (this.worldServer != null) {
@@ -321,12 +480,14 @@ @@ -321,12 +481,14 @@
aworldserver = this.worldServer; aworldserver = this.worldServer;
i = aworldserver.length; i = aworldserver.length;
@ -359,7 +360,7 @@
} }
if (this.m.d()) { if (this.m.d()) {
@@ -366,6 +527,7 @@ @@ -366,6 +528,7 @@
long k = j - this.aa; long k = j - this.aa;
if (k > 2000L && this.aa - this.Q >= 15000L) { if (k > 2000L && this.aa - this.Q >= 15000L) {
@ -367,7 +368,7 @@
MinecraftServer.LOGGER.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(k), Long.valueOf(k / 50L)}); MinecraftServer.LOGGER.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(k), Long.valueOf(k / 50L)});
k = 2000L; k = 2000L;
this.Q = this.aa; this.Q = this.aa;
@@ -378,11 +540,12 @@ @@ -378,11 +541,12 @@
i += k; i += k;
this.aa = j; this.aa = j;
@ -381,7 +382,7 @@
i -= 50L; i -= 50L;
this.C(); this.C();
} }
@@ -420,6 +583,12 @@ @@ -420,6 +584,12 @@
} catch (Throwable throwable1) { } catch (Throwable throwable1) {
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1); MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
} finally { } finally {
@ -394,7 +395,7 @@
this.B(); this.B();
} }
@@ -463,7 +632,7 @@ @@ -463,7 +633,7 @@
public void B() {} public void B() {}
@ -403,7 +404,7 @@
long i = System.nanoTime(); long i = System.nanoTime();
++this.ticks; ++this.ticks;
@@ -489,7 +658,7 @@ @@ -489,7 +659,7 @@
this.q.b().a(agameprofile); this.q.b().a(agameprofile);
} }
@ -412,7 +413,7 @@
this.methodProfiler.a("save"); this.methodProfiler.a("save");
this.v.savePlayers(); this.v.savePlayers();
this.saveChunks(true); this.saveChunks(true);
@@ -524,20 +693,40 @@ @@ -524,20 +694,40 @@
this.methodProfiler.c("levels"); this.methodProfiler.c("levels");
@ -456,7 +457,7 @@
this.methodProfiler.a("tick"); this.methodProfiler.a("tick");
@@ -564,9 +753,9 @@ @@ -564,9 +754,9 @@
worldserver.getTracker().updatePlayers(); worldserver.getTracker().updatePlayers();
this.methodProfiler.b(); this.methodProfiler.b();
this.methodProfiler.b(); this.methodProfiler.b();
@ -468,7 +469,7 @@
} }
this.methodProfiler.c("connection"); this.methodProfiler.c("connection");
@@ -590,10 +779,11 @@ @@ -590,10 +780,11 @@
this.o.add(itickable); this.o.add(itickable);
} }
@ -481,7 +482,7 @@
boolean flag = true; boolean flag = true;
String s = null; String s = null;
String s1 = "."; String s1 = ".";
@@ -638,13 +828,16 @@ @@ -638,13 +829,16 @@
++j; ++j;
} }
} }
@ -499,7 +500,7 @@
if (s != null) { if (s != null) {
dedicatedserver.i(s); dedicatedserver.i(s);
} }
@@ -675,6 +868,25 @@ @@ -675,6 +869,25 @@
dedicatedserver.stop(); dedicatedserver.stop();
} }
}); });
@ -525,7 +526,7 @@
} catch (Exception exception) { } catch (Exception exception) {
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception); MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
} }
@@ -682,8 +894,10 @@ @@ -682,8 +895,10 @@
} }
public void F() { public void F() {
@ -536,7 +537,7 @@
} }
public File d(String s) { public File d(String s) {
@@ -699,7 +913,14 @@ @@ -699,7 +914,14 @@
} }
public WorldServer getWorldServer(int i) { public WorldServer getWorldServer(int i) {
@ -552,7 +553,7 @@
} }
public String getVersion() { public String getVersion() {
@@ -723,7 +944,7 @@ @@ -723,7 +945,7 @@
} }
public boolean isDebugging() { public boolean isDebugging() {
@ -561,7 +562,7 @@
} }
public void g(String s) { public void g(String s) {
@@ -738,7 +959,7 @@ @@ -738,7 +960,7 @@
} }
public String getServerModName() { public String getServerModName() {
@ -570,7 +571,7 @@
} }
public CrashReport b(CrashReport crashreport) { public CrashReport b(CrashReport crashreport) {
@@ -767,6 +988,7 @@ @@ -767,6 +989,7 @@
} }
public List<String> tabCompleteCommand(ICommandListener icommandlistener, String s, @Nullable BlockPosition blockposition, boolean flag) { public List<String> tabCompleteCommand(ICommandListener icommandlistener, String s, @Nullable BlockPosition blockposition, boolean flag) {
@ -578,7 +579,7 @@
ArrayList arraylist = Lists.newArrayList(); ArrayList arraylist = Lists.newArrayList();
boolean flag1 = s.startsWith("/"); boolean flag1 = s.startsWith("/");
@@ -809,10 +1031,13 @@ @@ -809,10 +1032,13 @@
return arraylist; return arraylist;
} }
@ -593,7 +594,7 @@
} }
public String getName() { public String getName() {
@@ -868,11 +1093,13 @@ @@ -868,11 +1094,13 @@
} }
public void a(EnumDifficulty enumdifficulty) { public void a(EnumDifficulty enumdifficulty) {
@ -610,7 +611,7 @@
if (worldserver != null) { if (worldserver != null) {
if (worldserver.getWorldData().isHardcore()) { if (worldserver.getWorldData().isHardcore()) {
@@ -939,13 +1166,11 @@ @@ -939,13 +1167,11 @@
int i = 0; int i = 0;
if (this.worldServer != null) { if (this.worldServer != null) {
@ -628,7 +629,7 @@
WorldData worlddata = worldserver.getWorldData(); WorldData worlddata = worldserver.getWorldData();
mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimensionManager().getDimensionID())); mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimensionManager().getDimensionID()));
@@ -978,7 +1203,7 @@ @@ -978,7 +1204,7 @@
public abstract boolean aa(); public abstract boolean aa();
public boolean getOnlineMode() { public boolean getOnlineMode() {
@ -637,7 +638,7 @@
} }
public void setOnlineMode(boolean flag) { public void setOnlineMode(boolean flag) {
@@ -1050,13 +1275,9 @@ @@ -1050,13 +1276,9 @@
} }
public void setGamemode(EnumGamemode enumgamemode) { public void setGamemode(EnumGamemode enumgamemode) {
@ -654,7 +655,7 @@
} }
} }
@@ -1088,7 +1309,7 @@ @@ -1088,7 +1310,7 @@
} }
public World getWorld() { public World getWorld() {
@ -663,7 +664,7 @@
} }
public Entity f() { public Entity f() {
@@ -1160,8 +1381,10 @@ @@ -1160,8 +1382,10 @@
WorldServer[] aworldserver = this.worldServer; WorldServer[] aworldserver = this.worldServer;
int i = aworldserver.length; int i = aworldserver.length;
@ -676,7 +677,7 @@
if (worldserver != null) { if (worldserver != null) {
Entity entity = worldserver.getEntity(uuid); Entity entity = worldserver.getEntity(uuid);
@@ -1176,7 +1399,7 @@ @@ -1176,7 +1400,7 @@
} }
public boolean getSendCommandFeedback() { public boolean getSendCommandFeedback() {
@ -685,7 +686,7 @@
} }
public void a(CommandObjectiveExecutor.EnumCommandResult commandobjectiveexecutor_enumcommandresult, int i) {} public void a(CommandObjectiveExecutor.EnumCommandResult commandobjectiveexecutor_enumcommandresult, int i) {}
@@ -1191,7 +1414,7 @@ @@ -1191,7 +1415,7 @@
public <V> ListenableFuture<V> a(Callable<V> callable) { public <V> ListenableFuture<V> a(Callable<V> callable) {
Validate.notNull(callable); Validate.notNull(callable);
@ -694,7 +695,7 @@
ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable); ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable);
Queue queue = this.j; Queue queue = this.j;
@@ -1236,4 +1459,11 @@ @@ -1236,4 +1460,11 @@
public int a(@Nullable WorldServer worldserver) { public int a(@Nullable WorldServer worldserver) {
return worldserver != null ? worldserver.getGameRules().c("spawnRadius") : 10; return worldserver != null ? worldserver.getGameRules().c("spawnRadius") : 10;
} }