SPIGOT-626: Add populators early to prevent chunks being missed

By: Thinkofdeath <thinkofdeath@spigotmc.org>
This commit is contained in:
CraftBukkit/Spigot
2015-03-08 10:08:19 +00:00
parent 88b41a7ab2
commit 0c5e6e0dac
2 changed files with 69 additions and 70 deletions

View File

@@ -1,5 +1,5 @@
--- /home/matt/mc-dev-private//net/minecraft/server/MinecraftServer.java 2015-02-26 22:40:22.875608136 +0000
+++ src/main/java/net/minecraft/server/MinecraftServer.java 2015-02-26 22:40:22.879608136 +0000
--- /home/matt/mc-dev-private//net/minecraft/server/MinecraftServer.java 2015-03-08 10:08:09.275589093 +0000
+++ src/main/java/net/minecraft/server/MinecraftServer.java 2015-03-08 10:08:09.279589093 +0000
@@ -38,14 +38,27 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -104,7 +104,7 @@
this.i = new long[this.worldServer.length][100];
IDataManager idatamanager = this.convertable.a(s, true);
@@ -167,37 +223,112 @@
@@ -167,37 +223,108 @@
worlddata.a(s1);
worldsettings = new WorldSettings(worlddata);
}
@@ -204,10 +204,6 @@
+ }
+ worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
+ world = (WorldServer) new SecondaryWorldServer(this, idatamanager, dimension, this.worlds.get(0), this.methodProfiler, worlddata, org.bukkit.World.Environment.getEnvironment(dimension), gen).b();
+ }
+
+ if (gen != null) {
+ world.getWorld().getPopulators().addAll(gen.getDefaultPopulators(world.getWorld()));
}
- this.worldServer[j].addIWorldAccess(new WorldManager(this, this.worldServer[j]));
@@ -228,7 +224,7 @@
this.a(this.getDifficulty());
this.k();
}
@@ -212,25 +343,38 @@
@@ -212,25 +339,38 @@
this.b("menu.generatingTerrain");
byte b0 = 0;
@@ -282,7 +278,7 @@
this.r();
}
@@ -264,35 +408,52 @@
@@ -264,35 +404,52 @@
protected void r() {
this.f = null;
this.g = 0;
@@ -344,7 +340,7 @@
if (this.ap() != null) {
this.ap().b();
}
@@ -307,11 +468,13 @@
@@ -307,11 +464,13 @@
MinecraftServer.LOGGER.info("Saving worlds");
this.saveChunks(false);
@@ -358,7 +354,7 @@
}
if (this.n.d()) {
@@ -352,6 +515,7 @@
@@ -352,6 +511,7 @@
long k = j - this.ab;
if (k > 2000L && this.ab - this.R >= 15000L) {
@@ -366,7 +362,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)});
k = 2000L;
this.R = this.ab;
@@ -364,11 +528,12 @@
@@ -364,11 +524,12 @@
i += k;
this.ab = j;
@@ -380,7 +376,7 @@
i -= 50L;
this.z();
}
@@ -406,6 +571,12 @@
@@ -406,6 +567,12 @@
} catch (Throwable throwable1) {
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
} finally {
@@ -393,7 +389,7 @@
this.y();
}
@@ -445,7 +616,7 @@
@@ -445,7 +612,7 @@
protected void y() {}
@@ -402,7 +398,7 @@
long i = System.nanoTime();
++this.ticks;
@@ -471,7 +642,7 @@
@@ -471,7 +638,7 @@
this.r.b().a(agameprofile);
}
@@ -411,7 +407,7 @@
this.methodProfiler.a("save");
this.v.savePlayers();
this.saveChunks(true);
@@ -506,20 +677,40 @@
@@ -506,20 +673,40 @@
this.methodProfiler.c("levels");
@@ -455,7 +451,7 @@
this.methodProfiler.a("tick");
@@ -546,9 +737,9 @@
@@ -546,9 +733,9 @@
worldserver.getTracker().updatePlayers();
this.methodProfiler.b();
this.methodProfiler.b();
@@ -467,7 +463,7 @@
}
this.methodProfiler.c("connection");
@@ -572,10 +763,11 @@
@@ -572,10 +759,11 @@
this.p.add(iupdateplayerlistbox);
}
@@ -480,7 +476,7 @@
boolean flag = true;
String s = null;
String s1 = ".";
@@ -653,6 +845,27 @@
@@ -653,6 +841,27 @@
dedicatedserver.stop();
}
});
@@ -508,7 +504,7 @@
} catch (Exception exception) {
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
}
@@ -660,8 +873,10 @@
@@ -660,8 +869,10 @@
}
public void C() {
@@ -519,7 +515,7 @@
}
public File d(String s) {
@@ -677,7 +892,14 @@
@@ -677,7 +888,14 @@
}
public WorldServer getWorldServer(int i) {
@@ -535,7 +531,7 @@
}
public String D() {
@@ -713,7 +935,7 @@
@@ -713,7 +931,7 @@
}
public boolean isDebugging() {
@@ -544,7 +540,7 @@
}
public void g(String s) {
@@ -728,7 +950,7 @@
@@ -728,7 +946,7 @@
}
public String getServerModName() {
@@ -553,7 +549,7 @@
}
public CrashReport b(CrashReport crashreport) {
@@ -757,6 +979,7 @@
@@ -757,6 +975,7 @@
}
public List<String> tabCompleteCommand(ICommandListener icommandlistener, String s, BlockPosition blockposition) {
@@ -561,7 +557,7 @@
ArrayList arraylist = Lists.newArrayList();
if (s.startsWith("/")) {
@@ -795,6 +1018,9 @@
@@ -795,6 +1014,9 @@
return arraylist;
}
@@ -571,7 +567,7 @@
}
public static MinecraftServer getServer() {
@@ -802,7 +1028,7 @@
@@ -802,7 +1024,7 @@
}
public boolean N() {
@@ -580,7 +576,7 @@
}
public String getName() {
@@ -858,8 +1084,10 @@
@@ -858,8 +1080,10 @@
}
public void a(EnumDifficulty enumdifficulty) {
@@ -593,7 +589,7 @@
if (worldserver != null) {
if (worldserver.getWorldData().isHardcore()) {
@@ -901,15 +1129,17 @@
@@ -901,15 +1125,17 @@
this.N = true;
this.getConvertable().d();
@@ -615,7 +611,7 @@
this.safeShutdown();
}
@@ -942,9 +1172,11 @@
@@ -942,9 +1168,11 @@
int i = 0;
if (this.worldServer != null) {
@@ -630,7 +626,7 @@
WorldData worlddata = worldserver.getWorldData();
mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimension()));
@@ -977,7 +1209,7 @@
@@ -977,7 +1205,7 @@
public abstract boolean ad();
public boolean getOnlineMode() {
@@ -639,7 +635,7 @@
}
public void setOnlineMode(boolean flag) {
@@ -1049,8 +1281,9 @@
@@ -1049,8 +1277,9 @@
}
public void setGamemode(WorldSettings.EnumGamemode worldsettings_enumgamemode) {
@@ -651,7 +647,7 @@
}
}
@@ -1082,7 +1315,7 @@
@@ -1082,7 +1311,7 @@
}
public World getWorld() {
@@ -660,7 +656,7 @@
}
public Entity f() {
@@ -1153,8 +1386,10 @@
@@ -1153,8 +1382,10 @@
WorldServer[] aworldserver = this.worldServer;
int i = aworldserver.length;
@@ -673,7 +669,7 @@
if (worldserver != null) {
Entity entity = worldserver.getEntity(uuid);
@@ -1169,7 +1404,7 @@
@@ -1169,7 +1400,7 @@
}
public boolean getSendCommandFeedback() {