mirror of
https://github.com/PaperMC/Paper.git
synced 2025-05-28 19:21:05 +00:00
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: MiniDigger | Martin <admin@minidigger.dev> Co-authored-by: Nassim Jahnke <nassim@njahnke.dev> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com> Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
35 lines
1.9 KiB
Diff
35 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Mon, 20 Jan 2025 13:30:34 -0800
|
|
Subject: [PATCH] Flush regionfiles on save configuration option
|
|
|
|
The windows file system does not write metadata unless
|
|
the FileChannel is explicitly flushed with metaData=true.
|
|
|
|
Note: Setting SYNC (not DSYNC) on the FileChannel does not appear
|
|
to write the metadata.
|
|
|
|
Specifically, we are interested in writing the last modified
|
|
timestamp so that fs watchers can detect when RegionFiles are
|
|
modified.
|
|
|
|
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
|
|
index 1acea58838f057ab87efd103cbecb6f5aeaef393..98fbc5c8044bd945d64569f13412a6e7e49a4e7f 100644
|
|
--- a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
|
|
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
|
|
@@ -1258,6 +1258,14 @@ public final class MoonriseRegionFileIO {
|
|
|
|
try {
|
|
this.regionDataController.finishWrite(this.chunkX, this.chunkZ, writeData);
|
|
+ // Paper start - flush regionfiles on save
|
|
+ if (this.world.paperConfig().chunks.flushRegionsOnSave) {
|
|
+ final RegionFile regionFile = this.regionDataController.getCache().moonrise$getRegionFileIfLoaded(this.chunkX, this.chunkZ);
|
|
+ if (regionFile != null) {
|
|
+ regionFile.flush();
|
|
+ } // else: evicted from cache, which should have called flush
|
|
+ }
|
|
+ // Paper end - flush regionfiles on save
|
|
} catch (final Throwable thr) {
|
|
failedWrite = thr instanceof IOException;
|
|
LOGGER.error("Failed to write chunk data for task: " + this.toString(), thr);
|