mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 17:31:06 +01:00
35 lines
1.3 KiB
Diff
35 lines
1.3 KiB
Diff
--- a/net/minecraft/server/RegionFileCache.java
|
|
+++ b/net/minecraft/server/RegionFileCache.java
|
|
@@ -76,18 +76,28 @@
|
|
}
|
|
|
|
@Nullable
|
|
- public static DataInputStream read(File file, int i, int j) {
|
|
+ // CraftBukkit start - call sites hoisted for synchronization
|
|
+ public static synchronized NBTTagCompound read(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);
|
|
}
|
|
|
|
@Nullable
|
|
- public static DataOutputStream write(File file, int i, int j) {
|
|
+ public static synchronized void write(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException {
|
|
RegionFile regionfile = a(file, i, j);
|
|
|
|
- return regionfile.c(i & 31, j & 31);
|
|
+ DataOutputStream dataoutputstream = regionfile.c(i & 31, j & 31);
|
|
+ NBTCompressedStreamTools.a(nbttagcompound, (java.io.DataOutput) dataoutputstream);
|
|
+ dataoutputstream.close();
|
|
}
|
|
+ // CraftBukkit end
|
|
|
|
public static synchronized boolean chunkExists(File file, int i, int j) {
|
|
RegionFile regionfile = b(file, i, j);
|