Add option to flush region files on save (#9149)

This commit is contained in:
Redned 2023-05-12 15:07:24 -05:00
parent 0dd7fe3b9c
commit 07674ea170
2 changed files with 8 additions and 0 deletions

View file

@ -1880,6 +1880,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ map.put(EntityType.FIREBALL, -1);
+ map.put(EntityType.SMALL_FIREBALL, -1);
+ });
+ public boolean flushRegionsOnSave = false;
+ }
+
+ public FishingTimeRange fishingTimeRange;

View file

@ -5749,6 +5749,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ if (flush) {
+ RegionFileIOThread.flush();
+ if (this.world.paperConfig().chunks.flushRegionsOnSave) {
+ try {
+ this.world.chunkSource.chunkMap.regionFileCache.flush();
+ } catch (IOException ex) {
+ LOGGER.error("Exception when flushing regions in world {}", this.world.getWorld().getName(), ex);
+ }
+ }
+ }
+ if (logProgress) {
+ LOGGER.info("Saved " + savedChunk + " block chunks, " + savedEntity + " entity chunks, " + savedPoi + " poi chunks in world '" + this.world.getWorld().getName() + "' in " + format.format(1.0E-9 * (System.nanoTime() - start)) + "s");