56 lines
2 KiB
Diff
56 lines
2 KiB
Diff
From a0abacdfc37269d8eb814ba87c6e22a51cefaed9 Mon Sep 17 00:00:00 2001
|
|
From: drXor <mcyoungsota@gmail.com>
|
|
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 08efc91..5230d6d 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -485,7 +485,13 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
|
if (this.n.d()) {
|
|
this.n.e();
|
|
}
|
|
-
|
|
+ // Spigot start
|
|
+ if( org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly )
|
|
+ {
|
|
+ LOGGER.info("Saving usercache.json");
|
|
+ this.Z.c();
|
|
+ }
|
|
+ //Spigot end
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
|
|
index 8001b8a..4450ea3 100644
|
|
--- a/src/main/java/net/minecraft/server/UserCache.java
|
|
+++ b/src/main/java/net/minecraft/server/UserCache.java
|
|
@@ -149,7 +149,7 @@ public class UserCache {
|
|
}
|
|
}
|
|
|
|
- this.c();
|
|
+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled
|
|
return usercache_usercacheentry == null ? null : usercache_usercacheentry.a();
|
|
}
|
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
index e88765b..f35e92e 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
@@ -322,4 +322,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 );
|
|
+ }
|
|
}
|
|
--
|
|
2.1.4
|
|
|