PaperSpigot-Parent/CraftBukkit-Patches/0122-Configurable-save-on-stop-only-for-UserCache.patch
Zach Brown 8bbab87c6b Update from upstream SpigotMC
3e3ea0bd0d8
320ed92779f
612de468951
2014-12-14 15:54:10 -06:00

57 lines
2.0 KiB
Diff

From 5eac7a493a7bf835399fbf0bbf3cd28dee1502ad 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 8521259..f13be48 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -455,7 +455,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
if (this.m.d()) {
this.m.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 3eeaf09..03abfbd 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -120,7 +120,7 @@ public class UserCache {
}
}
- this.c();
+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled
return usercacheentry == null ? null : usercacheentry.a();
}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index d416087..78dcb39 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -321,4 +321,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.0