private boolean isSavingNecessary() {
    ChunkProvider chunkProvider = CoreRegistry.get(ChunkProvider.class);
    int unloadedChunkCount = unloadedAndUnsavedChunkMap.size();
    int loadedChunkCount = chunkProvider.getAllChunks().size();
    double totalChunkCount = unloadedChunkCount + loadedChunkCount;
    double percentageUnloaded = 100.0 * unloadedChunkCount / totalChunkCount;
    if (percentageUnloaded >= config.getSystem().getMaxUnloadedChunksPercentageTillSave()) {
      return true;
    }

    long currentTime = System.currentTimeMillis();
    if (nextAutoSave == null) {
      scheduleNextAutoSave();
      return false;
    }
    return currentTime >= nextAutoSave;
  }
 private void scheduleNextAutoSave() {
   long msBetweenAutoSave = config.getSystem().getMaxSecondsBetweenSaves() * 1000;
   nextAutoSave = System.currentTimeMillis() + msBetweenAutoSave;
 }
 /**
  * The Advanced Monitor is a display opening in a separate window allowing for monitoring of
  * Threads, Chunks and Performance.
  */
 private void initAdvancedMonitor() {
   if (config.getSystem().isMonitoringEnabled()) {
     new AdvancedMonitor().setVisible(true);
   }
 }