2015-07-27 12:20:54 +00:00
|
|
|
From f8d2ebece4cbfea47c0508af16e7319fad0feeba Mon Sep 17 00:00:00 2001
|
2014-07-21 20:46:54 +00:00
|
|
|
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
|
2015-07-27 12:20:54 +00:00
|
|
|
index a8fe417..1e6e401 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2015-07-12 09:59:20 +00:00
|
|
|
@@ -485,7 +485,13 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
2015-02-28 11:36:22 +00:00
|
|
|
if (this.n.d()) {
|
|
|
|
this.n.e();
|
2014-07-21 20:46:54 +00:00
|
|
|
}
|
2014-11-28 01:17:45 +00:00
|
|
|
-
|
2014-07-21 20:46:54 +00:00
|
|
|
+ // Spigot start
|
|
|
|
+ if( org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly )
|
|
|
|
+ {
|
2014-11-28 01:17:45 +00:00
|
|
|
+ LOGGER.info("Saving usercache.json");
|
|
|
|
+ this.Z.c();
|
2014-07-21 20:46:54 +00:00
|
|
|
+ }
|
|
|
|
+ //Spigot end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
|
2015-07-23 20:43:27 +00:00
|
|
|
index 8001b8a..85277a6 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/UserCache.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/UserCache.java
|
2015-07-23 20:43:27 +00:00
|
|
|
@@ -121,7 +121,7 @@ public class UserCache {
|
|
|
|
this.c.put(gameprofile.getName().toLowerCase(Locale.ROOT), usercache_usercacheentry);
|
|
|
|
this.d.put(uuid, usercache_usercacheentry);
|
|
|
|
this.e.addFirst(gameprofile);
|
|
|
|
- this.c();
|
|
|
|
+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled
|
|
|
|
}
|
|
|
|
|
|
|
|
public GameProfile getProfile(String s) {
|
2015-05-09 20:23:26 +00:00
|
|
|
@@ -149,7 +149,7 @@ public class UserCache {
|
2014-07-21 20:46:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- this.c();
|
|
|
|
+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled
|
2015-02-28 11:36:22 +00:00
|
|
|
return usercache_usercacheentry == null ? null : usercache_usercacheentry.a();
|
2014-07-21 20:46:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
2015-05-25 19:09:58 +00:00
|
|
|
index e88765b..f35e92e 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
2015-05-25 19:09:58 +00:00
|
|
|
@@ -322,4 +322,10 @@ public class SpigotConfig
|
2014-07-21 20:46:54 +00:00
|
|
|
{
|
|
|
|
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 );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
2015-05-29 09:35:21 +00:00
|
|
|
2.1.4
|
2014-07-21 20:46:54 +00:00
|
|
|
|