mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 10:35:38 +01:00
SPIGOT-5680: isChunkGenerated creates empty region files
This commit is contained in:
parent
e1335932a7
commit
b331a05509
@ -17,16 +17,21 @@
|
|||||||
RegionFile regionfile1 = new RegionFile(file, this.b);
|
RegionFile regionfile1 = new RegionFile(file, this.b);
|
||||||
|
|
||||||
this.cache.putAndMoveToFirst(i, regionfile1);
|
this.cache.putAndMoveToFirst(i, regionfile1);
|
||||||
@@ -43,7 +44,7 @@
|
@@ -43,7 +44,12 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
||||||
- RegionFile regionfile = this.getFile(chunkcoordintpair);
|
- 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);
|
DataInputStream datainputstream = regionfile.a(chunkcoordintpair);
|
||||||
Throwable throwable = null;
|
Throwable throwable = null;
|
||||||
|
|
||||||
@@ -78,7 +79,7 @@
|
@@ -78,7 +84,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {
|
protected void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {
|
||||||
@ -35,16 +40,3 @@
|
|||||||
DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair);
|
DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair);
|
||||||
Throwable throwable = null;
|
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
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user