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
parent 9b1c65cf48
commit 6fef4e1b23
2 changed files with 5 additions and 5 deletions

View file

@ -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 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 --- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -0,0 +0,0 @@ public abstract class RegionFileCache implements AutoCloseable { @@ -0,0 +0,0 @@ public abstract class RegionFileCache implements AutoCloseable {
@ -299,7 +299,7 @@ index 990d34efde..b61864641c 100644
RegionFile regionfile = (RegionFile) this.cache.getAndMoveToFirst(i); RegionFile regionfile = (RegionFile) this.cache.getAndMoveToFirst(i);
@@ -0,0 +0,0 @@ public abstract class RegionFileCache implements AutoCloseable { @@ -0,0 +0,0 @@ public abstract class RegionFileCache implements AutoCloseable {
public synchronized boolean hasRegionFile(File file, int i, int j) { 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 + // Paper start
+ private static void printOversizedLog(String msg, File file, int x, int z) { + private static void printOversizedLog(String msg, File file, int x, int z) {

View file

@ -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 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 --- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -0,0 +0,0 @@ import java.io.IOException; @@ -0,0 +0,0 @@ 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"); + File file1 = new File(file, "region");
+ return new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca"); + return new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca");
+ } + }
+ public synchronized boolean hasRegionFile(File file, int i, int j) { + 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 + // Paper End
+ +