Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/CraftBukkit-Patches/0108-Configurable-save-on-stop-only-for-UserCache.patch
2016-03-03 03:46:48 -06:00

64 Zeilen
2.4 KiB
Diff

From def6115f5c235487bdd296db0fe350bf4afce2e2 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 ebbb56e..650e2c1 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -485,6 +485,12 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.m.e();
}
+ // Spigot start
+ if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
+ LOGGER.info("Saving usercache.json");
+ this.X.c();
+ }
+ // Spigot end
}
public String getServerIp() {
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 4dcf736..825fed6 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -131,7 +131,7 @@ public class UserCache {
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
}
public GameProfile getProfile(String s) {
@@ -159,7 +159,7 @@ public class UserCache {
}
}
- this.c();
+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled
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
index e88765b..f35e92e 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 );
}
+
+ public static boolean saveUserCacheOnStopOnly;
+ private static void saveUserCacheOnStopOnly()
+ {
+ saveUserCacheOnStopOnly = getBoolean( "settings.save-user-cache-on-stop-only", false );
+ }
}
--
2.5.0