mirror of
https://github.com/barkeser2002/Tenet.git
synced 2026-09-25 05:19:53 +03:00
64 lines
2.5 KiB
Diff
64 lines
2.5 KiB
Diff
From 2944bcf4ee8aa777ccff1a7761612718e2100436 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 a0dfc63607..8fd7f5f959 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -965,6 +965,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 2071d44626..0ee2026472 100644
|
|
--- a/src/main/java/net/minecraft/server/players/UserCache.java
|
|
+++ b/src/main/java/net/minecraft/server/players/UserCache.java
|
|
@@ -117,7 +117,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() {
|
|
@@ -149,7 +149,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 6c68dc749c..dcb5270691 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.2
|
|
|