diff --git a/nms-patches/RegionFileCache.patch b/nms-patches/RegionFileCache.patch index 05bb3f941b..d756206f5b 100644 --- a/nms-patches/RegionFileCache.patch +++ b/nms-patches/RegionFileCache.patch @@ -17,16 +17,21 @@ RegionFile regionfile1 = new RegionFile(file, this.b); this.cache.putAndMoveToFirst(i, regionfile1); -@@ -43,7 +44,7 @@ +@@ -43,7 +44,12 @@ @Nullable public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException { - RegionFile regionfile = this.getFile(chunkcoordintpair); -+ RegionFile regionfile = this.getFile(chunkcoordintpair, false); // CraftBukkit ++ // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing ++ RegionFile regionfile = this.getFile(chunkcoordintpair, true); ++ if (regionfile == null) { ++ return null; ++ } ++ // CraftBukkit end DataInputStream datainputstream = regionfile.a(chunkcoordintpair); Throwable throwable = null; -@@ -78,7 +79,7 @@ +@@ -78,7 +84,7 @@ } protected void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { @@ -35,16 +40,3 @@ DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair); Throwable throwable = null; -@@ -114,4 +115,12 @@ - } - - } -+ -+ // CraftBukkit start -+ public boolean chunkExists(ChunkCoordIntPair pos) throws IOException { -+ RegionFile regionfile = getFile(pos, true); -+ -+ return regionfile != null ? regionfile.chunkExists(pos) : false; -+ } -+ // CraftBukkit end - }