3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

SPIGOT-5680: isChunkGenerated creates empty region files

Dieser Commit ist enthalten in:
md_5 2020-04-22 12:00:50 +10:00
Ursprung e1335932a7
Commit b331a05509

Datei anzeigen

@ -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
}