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

64 lines
2.4 KiB
Diff
Raw Normal View History

2018-01-22 01:19:57 +11:00
From 6c9673d1407f64e04c70380a0b35bd67ffbccff8 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
2017-11-17 10:24:35 +11:00
index 78dedb4fb..96f397506 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
2017-08-03 23:00:00 +10:00
@@ -506,6 +506,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
2016-03-01 08:33:06 +11:00
this.m.e();
}
2016-03-01 08:33:06 +11:00
+ // Spigot start
+ if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
+ LOGGER.info("Saving usercache.json");
2016-11-17 12:41:12 +11:00
+ this.Y.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
2017-11-17 10:24:35 +11:00
index 4a2d5cf09..d34768f8d 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
2017-05-14 12:00:00 +10:00
@@ -133,7 +133,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
2017-05-14 12:00:00 +10:00
@@ -162,7 +162,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
2017-11-17 10:24:35 +11:00
index 5d763bd45..532691f22 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 );
}
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 );
+ }
}
--
2017-11-10 10:52:45 +11:00
2.14.1