Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/Spigot-Server-Patches/0048-Don-t-create-Region-File-s-when-checking-if-chunk-ex.patch

54 Zeilen
2.2 KiB
Diff

2016-11-17 03:23:38 +01:00
From 6baf075a94cb42c637f90740d46550f578b01a4a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
2016-03-01 00:09:49 +01:00
Date: Wed, 2 Mar 2016 23:51:51 -0600
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
when using chunkExists.
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
2016-11-17 03:23:38 +01:00
index ca33899..8828275 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
2016-05-12 04:07:46 +02:00
@@ -39,7 +39,10 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
}
}
- return RegionFileCache.a(this.d, i, j).chunkExists(i & 31, j & 31);
2016-03-01 00:09:49 +01:00
+ // Paper start - Don't create region files when checking that they exist
+ final RegionFile region = RegionFileCache.a(this.d, i, j, false);
+ return region != null && region.chunkExists(i & 31, j & 31);
+ // Paper end
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
2016-11-17 03:23:38 +01:00
index f234298..933934f 100644
--- 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 {
public static final Map<File, RegionFile> a = Maps.newHashMap(); // Spigot - private -> public
2016-03-01 00:09:49 +01:00
+ // Paper start
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
+
+ public static synchronized RegionFile a(File file, int i, int j, boolean create) {
2016-03-01 00:09:49 +01:00
+ // Paper end
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 {
if (regionfile != null) {
return regionfile;
} else {
2016-03-01 00:09:49 +01:00
+ if (!create && !file2.exists()) { return null; } // Paper
if (!file1.exists()) {
file1.mkdirs();
}
--
2016-11-17 03:23:38 +01:00
2.10.2