0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/spigot.git synced 2024-11-21 20:56:14 +00:00
spigot/CraftBukkit-Patches/0047-Configurable-UserCache-cap.patch
2024-10-23 02:15:00 +11:00

38 lines
1.6 KiB
Diff

From 06bf35a6fa2dcf19723889d0b298bf429b25b1b8 Mon Sep 17 00:00:00 2001
From: drXor <mcyoungsota@gmail.com>
Date: Fri, 25 Apr 2014 18:17:30 -0400
Subject: [PATCH] Configurable UserCache cap
diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java
index 44645f5ee9..2791f6659d 100644
--- a/src/main/java/net/minecraft/server/players/UserCache.java
+++ b/src/main/java/net/minecraft/server/players/UserCache.java
@@ -261,7 +261,7 @@ public class UserCache {
JsonArray jsonarray = new JsonArray();
DateFormat dateformat = createDateFormat();
- this.getTopMRUProfiles(1000).forEach((usercache_usercacheentry) -> {
+ this.getTopMRUProfiles(org.spigotmc.SpigotConfig.userCacheCap).forEach((usercache_usercacheentry) -> { // Spigot
jsonarray.add(writeGameProfile(usercache_usercacheentry, dateformat));
});
String s = this.gson.toJson(jsonarray);
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index f20e896f2e..d8cd8b47ae 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -314,4 +314,10 @@ public class SpigotConfig
replaceCommands = new HashSet<String>( (List<String>) getList( "commands.replace-commands",
Arrays.asList( "setblock", "summon", "testforblock", "tellraw" ) ) );
}
+
+ public static int userCacheCap;
+ private static void userCacheCap()
+ {
+ userCacheCap = getInt( "settings.user-cache-size", 1000 );
+ }
}
--
2.47.0