From 8b0a5a3d0b5517d122c3361b48da7ac4fac260d3 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 26 May 2024 17:01:02 -0700 Subject: [PATCH] Do not load all players just to get a name. --- .../java/world/bentobox/bentobox/managers/PlayersManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/managers/PlayersManager.java b/src/main/java/world/bentobox/bentobox/managers/PlayersManager.java index 3b5ab228f..92f3814c1 100644 --- a/src/main/java/world/bentobox/bentobox/managers/PlayersManager.java +++ b/src/main/java/world/bentobox/bentobox/managers/PlayersManager.java @@ -157,8 +157,8 @@ public class PlayersManager { if (playerUUID == null) { return ""; } - return names.loadObjects().stream().filter(n -> n.getUuid().equals(playerUUID)).findFirst() - .map(Names::getUniqueId).orElse(""); + getPlayer(playerUUID); + return playerCache.get(playerUUID).getPlayerName(); } /**