示例#1
0
  /** 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();
      }
    }
  }
示例#2
0
  /**
   * 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();
  }