diff options
Diffstat (limited to 'nms-patches/RegionFileCache.patch')
-rw-r--r-- | nms-patches/RegionFileCache.patch | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/nms-patches/RegionFileCache.patch b/nms-patches/RegionFileCache.patch index 8628214f..aef8ddb9 100644 --- a/nms-patches/RegionFileCache.patch +++ b/nms-patches/RegionFileCache.patch @@ -1,6 +1,36 @@ --- a/net/minecraft/server/RegionFileCache.java +++ b/net/minecraft/server/RegionFileCache.java -@@ -76,18 +76,28 @@ +@@ -36,6 +36,29 @@ + } + } + ++ // CraftBukkit start ++ public static synchronized RegionFile b(File file, int i, int j) { ++ File file1 = new File(file, "region"); ++ File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca"); ++ RegionFile regionfile = (RegionFile) RegionFileCache.a.get(file2); ++ ++ if (regionfile != null) { ++ return regionfile; ++ } else if (file1.exists() && file2.exists()) { ++ if (RegionFileCache.a.size() >= 256) { ++ a(); ++ } ++ ++ RegionFile regionfile1 = new RegionFile(file2); ++ ++ RegionFileCache.a.put(file2, regionfile1); ++ return regionfile1; ++ } else { ++ return null; ++ } ++ } ++ // CraftBukkit end ++ + public static synchronized void a() { + Iterator iterator = RegionFileCache.a.values().iterator(); + +@@ -55,16 +78,32 @@ } @Nullable @@ -28,8 +58,12 @@ + DataOutputStream dataoutputstream = regionfile.c(i & 31, j & 31); + NBTCompressedStreamTools.a(nbttagcompound, (java.io.DataOutput) dataoutputstream); + dataoutputstream.close(); ++ } ++ ++ public static synchronized boolean chunkExists(File file, int i, int j) { ++ RegionFile regionfile = b(file, i, j); ++ ++ return regionfile != null ? regionfile.d(i & 31, j & 31) : false; } + // CraftBukkit end - - public static synchronized boolean chunkExists(File file, int i, int j) { - RegionFile regionfile = b(file, i, j); + } |