From b781c1e924ad1fe555548431234de68032ba3bab Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Tue, 1 Aug 2023 13:55:32 -0400 Subject: [PATCH] Add /ess usermap cache sub-command Allows to view the number of known UUIDs as well as name to UUID pairs. --- .../main/java/com/earth2me/essentials/EssentialsUpgrade.java | 2 +- .../com/earth2me/essentials/commands/Commandessentials.java | 2 ++ Essentials/src/main/resources/messages.properties | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/EssentialsUpgrade.java b/Essentials/src/main/java/com/earth2me/essentials/EssentialsUpgrade.java index ab3d46185..33fc06fb4 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/EssentialsUpgrade.java +++ b/Essentials/src/main/java/com/earth2me/essentials/EssentialsUpgrade.java @@ -963,7 +963,7 @@ public class EssentialsUpgrade { } } - uuids.put(uuid, config.getLong("timestamps.logout", 0L)); + uuids.put(uuid, time); nameToUuidMap.put(name, uuid); } } catch (IllegalArgumentException | IndexOutOfBoundsException ignored) { diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java index 2ada75532..f32cc655a 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java @@ -700,6 +700,8 @@ public class Commandessentials extends EssentialsCommand { } ess.getLogger().info("Found " + total + " orphaned userdata files."); }); + } else if (args[1].equalsIgnoreCase("cache")) { + sender.sendMessage(tl("usermapKnown", ess.getUsers().getAllUserUUIDs().size(), ess.getUsers().getNameCache().size())); } else { try { final UUID uuid = UUID.fromString(args[1]); diff --git a/Essentials/src/main/resources/messages.properties b/Essentials/src/main/resources/messages.properties index 3801a8a18..2a8408423 100644 --- a/Essentials/src/main/resources/messages.properties +++ b/Essentials/src/main/resources/messages.properties @@ -1462,6 +1462,7 @@ userIsAwaySelfWithMessage=\u00a77You are now AFK. userIsNotAwaySelf=\u00a77You are no longer AFK. userJailed=\u00a76You have been jailed\! usermapEntry=\u00a7c{0} \u00a76is mapped to \u00a7c{1}\u00a76. +usermapKnown=\u00a76There are \u00a7c{0} \u00a76known users to the user cache with \u00a7c{1} \u00a76name to UUID pairs. usermapPurge=\u00a76Checking for files in userdata that are not mapped, results will be logged to console. Destructive Mode: {0} usermapSize=\u00a76Current cached users in user map is \u00a7c{0}\u00a76/\u00a7c{1}\u00a76/\u00a7c{2}\u00a76. userUnknown=\u00a74Warning\: The user ''\u00a7c{0}\u00a74'' has never joined this server.