mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2025-09-18 21:33:01 +00:00
63 lines
2.5 KiB
Diff
63 lines
2.5 KiB
Diff
From cb2e1aa089a843e589c48d98c7a70eadacbd2410 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 e79578fa2..b7e370748 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -955,6 +955,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
} catch (IOException ioexception1) {
|
|
MinecraftServer.LOGGER.error("Failed to unlock level {}", this.storageSource.getLevelId(), ioexception1);
|
|
}
|
|
+ // Spigot start
|
|
+ if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
|
|
+ LOGGER.info("Saving usercache.json");
|
|
+ this.getProfileCache().save();
|
|
+ }
|
|
+ // Spigot end
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java
|
|
index 6ac3a04fd..e3286ffbf 100644
|
|
--- a/src/main/java/net/minecraft/server/players/UserCache.java
|
|
+++ b/src/main/java/net/minecraft/server/players/UserCache.java
|
|
@@ -118,7 +118,7 @@ public class UserCache {
|
|
UserCache.UserCacheEntry usercache_usercacheentry = new UserCache.UserCacheEntry(gameprofile, date);
|
|
|
|
this.safeAdd(usercache_usercacheentry);
|
|
- this.save();
|
|
+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.save(); // Spigot - skip saving if disabled
|
|
}
|
|
|
|
private long getNextOperation() {
|
|
@@ -150,7 +150,7 @@ public class UserCache {
|
|
}
|
|
}
|
|
|
|
- if (flag) {
|
|
+ if (flag && !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { // Spigot - skip saving if disabled
|
|
this.save();
|
|
}
|
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
index 285bb7a20..3540e2daf 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
@@ -320,4 +320,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.43.0
|
|
|