Fix issue where worlds were potentially unloaded improperly on server shutdown.

This commit is contained in:
LexManos 2012-11-29 04:05:00 -08:00
parent fdb2933ceb
commit e65c0a3d88
1 changed files with 12 additions and 7 deletions

View File

@ -95,17 +95,22 @@
this.setDifficultyForAllWorlds(this.getDifficulty()); this.setDifficultyForAllWorlds(this.getDifficulty());
this.initialWorldChunkLoad(); this.initialWorldChunkLoad();
} }
@@ -431,7 +411,9 @@ @@ -431,7 +411,14 @@
for (int var1 = 0; var1 < this.worldServers.length; ++var1) for (int var1 = 0; var1 < this.worldServers.length; ++var1)
{ {
WorldServer var2 = this.worldServers[var1]; WorldServer var2 = this.worldServers[var1];
+ MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(var2)); + MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(var2));
var2.flush(); var2.flush();
+ DimensionManager.setWorld(var2.provider.dimensionId, null); + }
+
+ WorldServer[] tmp = worldServers;
+ for (WorldServer world : tmp)
+ {
+ DimensionManager.setWorld(world.provider.dimensionId, null);
} }
if (this.usageSnooper != null && this.usageSnooper.isSnooperRunning()) if (this.usageSnooper != null && this.usageSnooper.isSnooperRunning())
@@ -645,13 +627,15 @@ @@ -645,13 +632,15 @@
this.theProfiler.startSection("levels"); this.theProfiler.startSection("levels");
int var1; int var1;
@ -126,7 +131,7 @@
this.theProfiler.startSection(var4.getWorldInfo().getWorldName()); this.theProfiler.startSection(var4.getWorldInfo().getWorldName());
this.theProfiler.startSection("pools"); this.theProfiler.startSection("pools");
var4.getWorldVec3Pool().clear(); var4.getWorldVec3Pool().clear();
@@ -698,9 +682,11 @@ @@ -698,9 +687,11 @@
this.theProfiler.endSection(); this.theProfiler.endSection();
} }
@ -141,7 +146,7 @@
this.theProfiler.endStartSection("connection"); this.theProfiler.endStartSection("connection");
this.getNetworkThread().networkTick(); this.getNetworkThread().networkTick();
this.theProfiler.endStartSection("players"); this.theProfiler.endStartSection("players");
@@ -754,7 +740,13 @@ @@ -754,7 +745,13 @@
*/ */
public WorldServer worldServerForDimension(int par1) public WorldServer worldServerForDimension(int par1)
{ {
@ -156,7 +161,7 @@
} }
@SideOnly(Side.SERVER) @SideOnly(Side.SERVER)
@@ -863,7 +855,7 @@ @@ -863,7 +860,7 @@
public String getServerModName() public String getServerModName()
{ {
@ -165,7 +170,7 @@
} }
/** /**
@@ -1125,6 +1117,7 @@ @@ -1125,6 +1122,7 @@
if (var2 != null) if (var2 != null)
{ {