papermc/CraftBukkit-Patches/0121-Configurable-save-on-stop-only-for-UserCache.patch

57 lines
2 KiB
Diff
Raw Normal View History

2015-02-28 11:36:22 +00:00
From 72323216aad70986d8456e4ee8812d1f2c9498bd 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
2015-02-28 11:36:22 +00:00
index b2ad2ca..6a12218 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
2015-02-28 11:36:22 +00:00
@@ -487,7 +487,13 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
if (this.n.d()) {
this.n.e();
}
2014-11-28 01:17:45 +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();
+ }
+ //Spigot end
}
}
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
2015-02-28 11:36:22 +00:00
index 9e36258..b8cde5d 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
2015-02-28 11:36:22 +00:00
@@ -150,7 +150,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
2014-11-28 01:17:45 +00:00
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 );
+ }
}
--
2014-11-28 01:17:45 +00:00
2.1.0