From 551c6c2dd97bc6a0e626d9726fa533d9b46ba75d Mon Sep 17 00:00:00 2001 From: drXor Date: Thu, 22 May 2014 09:01:33 -0400 Subject: [PATCH] Add config option for when UserCache saves --- ...able-save-on-stop-only-for-UserCache.patch | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 CraftBukkit-Patches/0147-Configurable-save-on-stop-only-for-UserCache.patch diff --git a/CraftBukkit-Patches/0147-Configurable-save-on-stop-only-for-UserCache.patch b/CraftBukkit-Patches/0147-Configurable-save-on-stop-only-for-UserCache.patch new file mode 100644 index 0000000000..65c3bd35dc --- /dev/null +++ b/CraftBukkit-Patches/0147-Configurable-save-on-stop-only-for-UserCache.patch @@ -0,0 +1,55 @@ +From b2169efce706955229fb6f7971522df6a1b311f1 Mon Sep 17 00:00:00 2001 +From: drXor +Date: Fri, 23 May 2014 18:05:10 -0400 +Subject: [PATCH] Configurable save-on-stop-only for UserCache + + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 357d11b..bacb595 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -419,6 +419,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo + if (this.l.d()) { + this.l.e(); + } ++ // Spigot start ++ if( org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) ++ { ++ i.info("Saving usercache.json"); ++ this.X.c(); ++ } ++ //Spigot end + } + } + +diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java +index ee8b6d6..cc178c6 100644 +--- a/src/main/java/net/minecraft/server/UserCache.java ++++ b/src/main/java/net/minecraft/server/UserCache.java +@@ -133,7 +133,7 @@ public class UserCache { + } + } + +- this.c(); ++ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled + return usercacheentry == null ? null : usercacheentry.a(); + } + +diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java +index 1d35846..b00f635 100644 +--- a/src/main/java/org/spigotmc/SpigotConfig.java ++++ b/src/main/java/org/spigotmc/SpigotConfig.java +@@ -304,4 +304,10 @@ public class SpigotConfig + { + userCacheCap = getInt( "settings.user-cache-size", 1000 ); + } ++ ++ public static boolean saveUserCacheOnStopOnly; ++ private static void saveUserCacheOnStopOnly() ++ { ++ saveUserCacheOnStopOnly = getBoolean( "settings.save-user-cache-on-stop-only", false ); ++ } + } +-- +1.9.1 +