From 542b7a7eb14eb390af87952191701d334182bac5 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Fri, 25 Apr 2014 18:17:30 -0400 Subject: [PATCH] Configurable UserCache cap By: drXor --- .../minecraft/server/players/GameProfileCache.java.patch | 9 +++++++++ .../src/main/java/org/spigotmc/SpigotConfig.java | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/paper-server/patches/sources/net/minecraft/server/players/GameProfileCache.java.patch b/paper-server/patches/sources/net/minecraft/server/players/GameProfileCache.java.patch index 331384a555..93ab1dd1ce 100644 --- a/paper-server/patches/sources/net/minecraft/server/players/GameProfileCache.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/players/GameProfileCache.java.patch @@ -36,3 +36,12 @@ Objects.requireNonNull(list); optional.ifPresent(list::add); +@@ -261,7 +261,7 @@ + JsonArray jsonarray = new JsonArray(); + DateFormat dateformat = GameProfileCache.createDateFormat(); + +- this.getTopMRUProfiles(1000).forEach((usercache_usercacheentry) -> { ++ this.getTopMRUProfiles(org.spigotmc.SpigotConfig.userCacheCap).forEach((usercache_usercacheentry) -> { // Spigot + jsonarray.add(GameProfileCache.writeGameProfile(usercache_usercacheentry, dateformat)); + }); + String s = this.gson.toJson(jsonarray); diff --git a/paper-server/src/main/java/org/spigotmc/SpigotConfig.java b/paper-server/src/main/java/org/spigotmc/SpigotConfig.java index 7366c020ea..59647d169d 100644 --- a/paper-server/src/main/java/org/spigotmc/SpigotConfig.java +++ b/paper-server/src/main/java/org/spigotmc/SpigotConfig.java @@ -314,4 +314,10 @@ public class SpigotConfig SpigotConfig.replaceCommands = new HashSet( (List) SpigotConfig.getList( "commands.replace-commands", Arrays.asList( "setblock", "summon", "testforblock", "tellraw" ) ) ); } + + public static int userCacheCap; + private static void userCacheCap() + { + SpigotConfig.userCacheCap = SpigotConfig.getInt( "settings.user-cache-size", 1000 ); + } }