3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 04:50:05 +01:00
Paper/nms-patches/RegionFileCache.patch

38 Zeilen
1.5 KiB
Diff

--- a/net/minecraft/server/RegionFileCache.java
+++ b/net/minecraft/server/RegionFileCache.java
@@ -74,19 +74,29 @@
RegionFileCache.a.clear();
}
- public static DataInputStream d(File file, int i, int j) {
+ // CraftBukkit start - call sites hoisted for synchronization
+ public static synchronized NBTTagCompound d(File file, int i, int j) throws IOException {
RegionFile regionfile = a(file, i, j);
- return regionfile.a(i & 31, j & 31);
+ DataInputStream datainputstream = regionfile.a(i & 31, j & 31);
+
+ if (datainputstream == null) {
+ return null;
+ }
+
+ return NBTCompressedStreamTools.a(datainputstream);
}
- public static DataOutputStream e(File file, int i, int j) {
+ public static synchronized void e(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException {
RegionFile regionfile = a(file, i, j);
- return regionfile.b(i & 31, j & 31);
+ DataOutputStream dataoutputstream = regionfile.b(i & 31, j & 31);
+ NBTCompressedStreamTools.a(nbttagcompound, (java.io.DataOutput) dataoutputstream);
+ dataoutputstream.close();
}
+ // CraftBukkit end
- public static boolean f(File file, int i, int j) {
+ public static synchronized boolean f(File file, int i, int j) { // PAIL chunkExists; CraftBukkit
RegionFile regionfile = b(file, i, j);
return regionfile != null ? regionfile.c(i & 31, j & 31) : false;