Fix RegionFileCache#hasRegionFile (#2062)

also remove the pointless synchronization on
RegionFileCache#getRegionFileName
This commit is contained in:
Spottedleaf 2019-05-19 19:26:17 -07:00 committed by Shane Freeder
parent 6b05c3f8d6
commit d189ac1db3
2 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
From 0c747969dc199cf6e1a914b30a64c294078e8749 Mon Sep 17 00:00:00 2001
From cfb0efe00f65ee5d31eab9a11261f0481b22cdb1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 29 Jul 2018 15:48:50 -0400
Subject: [PATCH] Provide option to use a versioned world folder for testing
@ -59,7 +59,7 @@ index a9b71c85d5..8c3880c838 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index 6425b14f2c..990d34efde 100644
index 6425b14f2c..74f102adf5 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -10,13 +10,41 @@ import java.io.IOException;
@ -116,12 +116,12 @@ index 6425b14f2c..990d34efde 100644
}
}
+ public static synchronized File getRegionFileName(File file, int i, int j) {
+ public static File getRegionFileName(File file, int i, int j) {
+ File file1 = new File(file, "region");
+ return new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca");
+ }
+ public synchronized boolean hasRegionFile(File file, int i, int j) {
+ return cache.containsKey(getRegionFileName(file, i, j));
+ return cache.containsKey(ChunkCoordIntPair.pair(i, j));
+ }
+ // Paper End
+

View File

@ -1,4 +1,4 @@
From b2b0e6b7957bca3f54f5c603b2afd5bb6bfe9ff9 Mon Sep 17 00:00:00 2001
From 35fe71a17f9f7b03759a454071bab4271c10218e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 15 Feb 2019 01:08:19 -0500
Subject: [PATCH] Allow Saving of Oversized Chunks
@ -286,7 +286,7 @@ index e68f901943..ed2ccebb23 100644
+
}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index 990d34efde..b61864641c 100644
index 74f102adf5..3f7190b6a2 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -47,6 +47,7 @@ public abstract class RegionFileCache implements AutoCloseable {
@ -299,7 +299,7 @@ index 990d34efde..b61864641c 100644
RegionFile regionfile = (RegionFile) this.cache.getAndMoveToFirst(i);
@@ -79,12 +80,151 @@ public abstract class RegionFileCache implements AutoCloseable {
public synchronized boolean hasRegionFile(File file, int i, int j) {
return cache.containsKey(getRegionFileName(file, i, j));
return cache.containsKey(ChunkCoordIntPair.pair(i, j));
}
+ // Paper start
+ private static void printOversizedLog(String msg, File file, int x, int z) {