Example #1
0
  /** par1 indicates if a log message should be output. */
  protected void saveAllWorlds(boolean dontLog) {
    if (!this.worldIsBeingDeleted) {
      WorldServer[] var2 = this.worldServers;
      int var3 = var2.length;

      for (int var4 = 0; var4 < var3; ++var4) {
        WorldServer var5 = var2[var4];

        if (var5 != null) {
          if (!dontLog) {
            logger.info(
                "Saving chunks for level \'"
                    + var5.getWorldInfo().getWorldName()
                    + "\'/"
                    + var5.provider.getDimensionName());
          }

          try {
            var5.saveAllChunks(true, (IProgressUpdate) null);
          } catch (MinecraftException var7) {
            logger.warn(var7.getMessage());
          }
        }
      }
    }
  }
  /** par1 indicates if a log message should be output. */
  protected void saveAllWorlds(boolean par1) {
    if (!this.worldIsBeingDeleted) {
      WorldServer[] aworldserver = this.worldServers;
      int i = aworldserver.length;

      for (int j = 0; j < i; ++j) {
        WorldServer worldserver = aworldserver[j];

        if (worldserver != null) {
          if (!par1) {
            this.func_98033_al()
                .func_98233_a(
                    "Saving chunks for level \'"
                        + worldserver.getWorldInfo().getWorldName()
                        + "\'/"
                        + worldserver.provider.getDimensionName());
          }

          try {
            worldserver.saveAllChunks(true, (IProgressUpdate) null);
          } catch (MinecraftException minecraftexception) {
            this.func_98033_al().func_98236_b(minecraftexception.getMessage());
          }
        }
      }
    }
  }
 /*
  * To be called by the server at the appropriate time, do not call from mod code.
  */
 public static void unloadWorlds(Hashtable<Integer, long[]> worldTickTimes) {
   for (int id : unloadQueue) {
     WorldServer w = worlds.get(id);
     try {
       if (w != null) {
         w.saveAllChunks(true, null);
       } else {
         FMLLog.warning("Unexpected world unload - world %d is already unloaded", id);
       }
     } catch (MinecraftException e) {
       e.printStackTrace();
     } finally {
       if (w != null) {
         MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(w));
         w.flush();
         setWorld(id, null);
       }
     }
   }
   unloadQueue.clear();
 }