mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2025-08-05 16:48:51 +00:00
63 lines
2.4 KiB
Diff
63 lines
2.4 KiB
Diff
From 5debdd771fac73dff690ff2a794b01d2a9da2df6 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 f2b072f..1cc4c08 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -505,6 +505,12 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
|
this.m.e();
|
|
}
|
|
|
|
+ // Spigot start
|
|
+ if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
|
|
+ LOGGER.info("Saving usercache.json");
|
|
+ this.Y.c();
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public String getServerIp() {
|
|
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
|
|
index d0ede6a..f159310 100644
|
|
--- a/src/main/java/net/minecraft/server/UserCache.java
|
|
+++ b/src/main/java/net/minecraft/server/UserCache.java
|
|
@@ -132,7 +132,7 @@ public class UserCache {
|
|
this.d.put(gameprofile.getName().toLowerCase(Locale.ROOT), usercache_usercacheentry);
|
|
this.e.put(uuid, usercache_usercacheentry);
|
|
this.f.addFirst(gameprofile);
|
|
- this.c();
|
|
+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled
|
|
}
|
|
|
|
@Nullable
|
|
@@ -161,7 +161,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 7f03f94..bd29318 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
@@ -323,4 +323,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.9.3
|
|
|