2017-04-29 02:25:52 +02:00
|
|
|
From 9d265dc548c5d1e3df9129a15865e70b1597451d Mon Sep 17 00:00:00 2001
|
2015-11-16 02:44:28 +01:00
|
|
|
From: Aikar <aikar@aikar.co>
|
2016-03-01 00:09:49 +01:00
|
|
|
Date: Wed, 2 Mar 2016 23:51:51 -0600
|
2015-11-16 02:44:28 +01:00
|
|
|
Subject: [PATCH] Don't create Region File's when checking if chunk exists
|
|
|
|
|
2016-03-01 00:09:49 +01:00
|
|
|
Plugins like Dynmap can end up creating tons of emtpy Region Files
|
2015-11-16 02:44:28 +01:00
|
|
|
when using chunkExists.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
|
2017-04-29 02:25:52 +02:00
|
|
|
index 6ec72689c..0163a4e59 100644
|
2015-11-16 02:44:28 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
|
2016-03-01 00:09:49 +01:00
|
|
|
@@ -12,7 +12,13 @@ public class RegionFileCache {
|
2015-11-16 02:44:28 +01:00
|
|
|
|
|
|
|
public static final Map<File, RegionFile> a = Maps.newHashMap(); // Spigot - private -> public
|
|
|
|
|
2016-03-01 00:09:49 +01:00
|
|
|
+ // Paper start
|
2015-11-16 02:44:28 +01:00
|
|
|
public static synchronized RegionFile a(File file, int i, int j) {
|
|
|
|
+ return a(file, i, j, true);
|
|
|
|
+ }
|
2016-03-01 00:09:49 +01:00
|
|
|
+
|
2015-11-16 02:44:28 +01:00
|
|
|
+ public static synchronized RegionFile a(File file, int i, int j, boolean create) {
|
2016-03-01 00:09:49 +01:00
|
|
|
+ // Paper end
|
2015-11-16 02:44:28 +01:00
|
|
|
File file1 = new File(file, "region");
|
|
|
|
File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca");
|
|
|
|
RegionFile regionfile = (RegionFile) RegionFileCache.a.get(file2);
|
2016-03-01 00:09:49 +01:00
|
|
|
@@ -20,6 +26,7 @@ public class RegionFileCache {
|
2015-11-16 02:44:28 +01:00
|
|
|
if (regionfile != null) {
|
|
|
|
return regionfile;
|
|
|
|
} else {
|
2016-03-01 00:09:49 +01:00
|
|
|
+ if (!create && !file2.exists()) { return null; } // Paper
|
2015-11-16 02:44:28 +01:00
|
|
|
if (!file1.exists()) {
|
|
|
|
file1.mkdirs();
|
|
|
|
}
|
|
|
|
--
|
2017-04-29 02:25:52 +02:00
|
|
|
2.12.2.windows.2
|
2015-11-16 02:44:28 +01:00
|
|
|
|