spigot/CraftBukkit-Patches/0088-Configurable-save-on-stop-only-for-UserCache.patch

64 lines
2.4 KiB
Diff
Raw Normal View History

2018-12-13 11:00:00 +11:00
From 34525b07a6926a1258bbe0bec28fabfbf2b5befa 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
2018-12-13 11:00:00 +11:00
index 5fb60e3f9..d64e6d230 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
2018-09-08 13:48:25 +10:00
@@ -660,6 +660,12 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
2018-12-13 11:00:00 +11:00
this.snooper.e();
}
2016-03-01 08:33:06 +11:00
+ // Spigot start
+ if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
+ LOGGER.info("Saving usercache.json");
2018-07-15 10:00:00 +10:00
+ this.getUserCache().c();
2016-03-01 08:33:06 +11:00
+ }
+ // Spigot end
}
2016-03-01 08:33:06 +11:00
public String getServerIp() {
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
2018-12-13 11:00:00 +11:00
index 585cf566a..4edc84986 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
2018-07-15 10:00:00 +10:00
@@ -132,7 +132,7 @@ public class UserCache {
2016-03-01 08:33:06 +11:00
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
}
2016-05-10 21:48:25 +10:00
@Nullable
2018-07-15 10:00:00 +10:00
@@ -161,7 +161,7 @@ public class UserCache {
}
}
- 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();
}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
2018-08-26 12:00:00 +10:00
index bf82b45c4..40f018f51 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -326,4 +326,10 @@ public class SpigotConfig
{
userCacheCap = getInt( "settings.user-cache-size", 1000 );
}
2016-11-17 12:41:12 +11:00
+
+ public static boolean saveUserCacheOnStopOnly;
+ private static void saveUserCacheOnStopOnly()
+ {
+ saveUserCacheOnStopOnly = getBoolean( "settings.save-user-cache-on-stop-only", false );
+ }
}
--
2018-11-14 14:20:34 +11:00
2.19.1