/** Saves all necessary data as preparation for stopping the server. */ public void stopServer() { if (!this.worldIsBeingDeleted) { logger.info("Stopping server"); if (this.getNetworkSystem() != null) { this.getNetworkSystem().terminateEndpoints(); } if (this.serverConfigManager != null) { logger.info("Saving players"); this.serverConfigManager.saveAllPlayerData(); this.serverConfigManager.removeAllPlayers(); } if (this.worldServers != null) { logger.info("Saving worlds"); this.saveAllWorlds(false); for (int var1 = 0; var1 < this.worldServers.length; ++var1) { WorldServer var2 = this.worldServers[var1]; var2.flush(); } } if (this.usageSnooper.isSnooperRunning()) { this.usageSnooper.stopSnooper(); } } }
/** Saves all necessary data as preparation for stopping the server. */ public void stopServer() { if (!this.worldIsBeingDeleted) { this.func_98033_al().func_98233_a("Stopping server"); if (this.getNetworkThread() != null) { this.getNetworkThread().stopListening(); } if (this.serverConfigManager != null) { this.func_98033_al().func_98233_a("Saving players"); this.serverConfigManager.saveAllPlayerData(); this.serverConfigManager.removeAllPlayers(); } this.func_98033_al().func_98233_a("Saving worlds"); this.saveAllWorlds(false); for (int i = 0; i < this.worldServers.length; ++i) { WorldServer worldserver = this.worldServers[i]; MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(worldserver)); worldserver.flush(); } WorldServer[] tmp = worldServers; for (WorldServer world : tmp) { DimensionManager.setWorld(world.provider.dimensionId, null); } if (this.usageSnooper != null && this.usageSnooper.isSnooperRunning()) { this.usageSnooper.stopSnooper(); } } }
/** * WARNING : directly calls * getActiveAnvilConverter().deleteWorldDirectory(theWorldServer[0].getSaveHandler().getWorldDirectoryName()); */ public void deleteWorldAndStopServer() { this.worldIsBeingDeleted = true; this.getActiveAnvilConverter().flushCache(); for (int var1 = 0; var1 < this.worldServers.length; ++var1) { WorldServer var2 = this.worldServers[var1]; if (var2 != null) { var2.flush(); } } this.getActiveAnvilConverter() .deleteWorldDirectory(this.worldServers[0].getSaveHandler().getWorldDirectoryName()); this.initiateShutdown(); }
/** * WARNING : directly calls * getActiveAnvilConverter().deleteWorldDirectory(theWorldServer[0].getSaveHandler().getSaveDirectoryName()); */ public void deleteWorldAndStopServer() { this.worldIsBeingDeleted = true; this.getActiveAnvilConverter().flushCache(); for (int i = 0; i < this.worldServers.length; ++i) { WorldServer worldserver = this.worldServers[i]; if (worldserver != null) { MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(worldserver)); worldserver.flush(); } } this.getActiveAnvilConverter() .deleteWorldDirectory(this.worldServers[0].getSaveHandler().getSaveDirectoryName()); this.initiateShutdown(); }
/* * 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(); }