コード例 #1
0
  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;
  }
コード例 #2
0
 private void scheduleNextAutoSave() {
   long msBetweenAutoSave = config.getSystem().getMaxSecondsBetweenSaves() * 1000;
   nextAutoSave = System.currentTimeMillis() + msBetweenAutoSave;
 }
コード例 #3
0
ファイル: TerasologyEngine.java プロジェクト: nahh/Terasology
 /**
  * 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);
   }
 }