2016-06-12 11:28:27 +02:00
|
|
|
--- a/net/minecraft/server/RegionFileCache.java
|
|
|
|
+++ b/net/minecraft/server/RegionFileCache.java
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -18,7 +18,7 @@
|
2019-12-10 23:00:00 +01:00
|
|
|
this.b = file;
|
2018-08-26 04:00:00 +02:00
|
|
|
}
|
|
|
|
|
2019-12-10 23:00:00 +01:00
|
|
|
- private RegionFile getFile(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
|
|
|
+ private RegionFile getFile(ChunkCoordIntPair chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit
|
2019-04-23 04:00:00 +02:00
|
|
|
long i = ChunkCoordIntPair.pair(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ());
|
|
|
|
RegionFile regionfile = (RegionFile) this.cache.getAndMoveToFirst(i);
|
2018-08-26 04:00:00 +02:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -34,6 +34,7 @@
|
|
|
|
}
|
|
|
|
|
2019-12-10 23:00:00 +01:00
|
|
|
File file = new File(this.b, "r." + chunkcoordintpair.getRegionX() + "." + chunkcoordintpair.getRegionZ() + ".mca");
|
2019-04-23 04:00:00 +02:00
|
|
|
+ if (existingOnly && !file.exists()) return null; // CraftBukkit
|
2019-12-10 23:00:00 +01:00
|
|
|
RegionFile regionfile1 = new RegionFile(file, this.b);
|
2019-04-23 04:00:00 +02:00
|
|
|
|
|
|
|
this.cache.putAndMoveToFirst(i, regionfile1);
|
2020-04-22 04:00:50 +02:00
|
|
|
@@ -43,7 +44,12 @@
|
2016-06-12 11:28:27 +02:00
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
@Nullable
|
2019-04-23 04:00:00 +02:00
|
|
|
public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
2019-12-10 23:00:00 +01:00
|
|
|
- RegionFile regionfile = this.getFile(chunkcoordintpair);
|
2020-04-22 04:00:50 +02:00
|
|
|
+ // 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
|
2019-04-23 04:00:00 +02:00
|
|
|
DataInputStream datainputstream = regionfile.a(chunkcoordintpair);
|
|
|
|
Throwable throwable = null;
|
2016-06-12 11:28:27 +02:00
|
|
|
|
2020-04-22 04:00:50 +02:00
|
|
|
@@ -78,7 +84,7 @@
|
2016-06-12 11:28:27 +02:00
|
|
|
}
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
protected void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {
|
2019-12-10 23:00:00 +01:00
|
|
|
- RegionFile regionfile = this.getFile(chunkcoordintpair);
|
|
|
|
+ RegionFile regionfile = this.getFile(chunkcoordintpair, false); // CraftBukkit
|
2019-04-23 04:00:00 +02:00
|
|
|
DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair);
|
|
|
|
Throwable throwable = null;
|
2016-06-12 11:28:27 +02:00
|
|
|
|