          this.setDifficultyForAllWorlds(this.getDifficulty());
          this.initialWorldChunkLoad();
      }
-@@ -431,7 +411,9 @@
+@@ -431,7 +411,14 @@
              for (int var1 = 0; var1 < this.worldServers.length; ++var1)
              {
                  WorldServer var2 = this.worldServers[var1];
 +                MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(var2));
                  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())
-@@ -645,13 +627,15 @@
+@@ -645,13 +632,15 @@
          this.theProfiler.startSection("levels");
          int var1;
  

         this.theProfiler.endStartSection("connection");
         this.getNetworkThread().networkTick();
         this.theProfiler.endStartSection("players");
@@ -754,7 +740,13 @@
      */
     public WorldServer worldServerForDimension(int par1)
     {

     }
 
     @SideOnly(Side.SERVER)
@@ -863,7 +860,7 @@
 
     public String getServerModName()
     {
