2013-12-01 04:40:53 +01:00
|
|
|
From 34d90bfbf38c020b7e10bb1fa2d3d95090f1a687 Mon Sep 17 00:00:00 2001
|
2013-04-26 12:35:16 +02:00
|
|
|
From: Antony Riley <antony@cyberiantiger.org>
|
|
|
|
Date: Wed, 27 Mar 2013 01:41:54 +0200
|
2013-06-21 09:46:00 +02:00
|
|
|
Subject: [PATCH] Close Unloaded Save Files
|
2013-04-26 12:35:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
|
|
|
|
index 900ed68..829f4a3 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
|
|
|
|
@@ -10,7 +10,7 @@ import java.util.Map;
|
|
|
|
|
|
|
|
public class RegionFileCache {
|
|
|
|
|
|
|
|
- private static final Map a = new HashMap();
|
|
|
|
+ public static final Map a = new HashMap(); // CraftBukkit - private -> public
|
|
|
|
|
|
|
|
public static synchronized RegionFile a(File file1, int i, int j) {
|
|
|
|
File file2 = new File(file1, "region");
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2013-12-01 04:40:53 +01:00
|
|
|
index 5eefd0d..5f5174b 100644
|
2013-04-26 12:35:16 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2013-12-01 04:40:53 +01:00
|
|
|
@@ -41,6 +41,8 @@ import net.minecraft.server.MinecraftServer;
|
2013-04-26 12:35:16 +02:00
|
|
|
import net.minecraft.server.MobEffectList;
|
|
|
|
import net.minecraft.server.PropertyManager;
|
|
|
|
import net.minecraft.server.ServerCommand;
|
|
|
|
+import net.minecraft.server.RegionFile;
|
|
|
|
+import net.minecraft.server.RegionFileCache;
|
|
|
|
import net.minecraft.server.ServerNBTManager;
|
|
|
|
import net.minecraft.server.WorldLoaderServer;
|
|
|
|
import net.minecraft.server.WorldManager;
|
2013-12-01 04:40:53 +01:00
|
|
|
@@ -850,6 +852,30 @@ public final class CraftServer implements Server {
|
2013-04-26 12:35:16 +02:00
|
|
|
worlds.remove(world.getName().toLowerCase());
|
|
|
|
console.worlds.remove(console.worlds.indexOf(handle));
|
|
|
|
|
|
|
|
+ File parentFolder = world.getWorldFolder().getAbsoluteFile();
|
|
|
|
+
|
|
|
|
+ // Synchronized because access to RegionFileCache.a is guarded by this lock.
|
|
|
|
+ synchronized (RegionFileCache.class) {
|
|
|
|
+ // RegionFileCache.a should be RegionFileCache.cache
|
|
|
|
+ Iterator<Map.Entry<File, RegionFile>> i = RegionFileCache.a.entrySet().iterator();
|
|
|
|
+ while(i.hasNext()) {
|
|
|
|
+ Map.Entry<File, RegionFile> entry = i.next();
|
|
|
|
+ File child = entry.getKey().getAbsoluteFile();
|
|
|
|
+ while (child != null) {
|
|
|
|
+ if (child.equals(parentFolder)) {
|
|
|
|
+ i.remove();
|
|
|
|
+ try {
|
|
|
|
+ entry.getValue().c(); // Should be RegionFile.close();
|
|
|
|
+ } catch (IOException ex) {
|
|
|
|
+ getLogger().log(Level.SEVERE, null, ex);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ child = child.getParentFile();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
--
|
2013-10-24 12:23:24 +02:00
|
|
|
1.8.3.2
|
2013-04-26 12:35:16 +02:00
|
|
|
|