Add /ess usermap cache sub-command

Allows to view the number of known UUIDs as
well as name to UUID pairs.
This commit is contained in:
Josh Roy 2023-08-01 13:55:32 -04:00 committed by MD
parent 19d6db0b4c
commit b781c1e924
3 changed files with 4 additions and 1 deletions

View File

@ -963,7 +963,7 @@ public class EssentialsUpgrade {
} }
} }
uuids.put(uuid, config.getLong("timestamps.logout", 0L)); uuids.put(uuid, time);
nameToUuidMap.put(name, uuid); nameToUuidMap.put(name, uuid);
} }
} catch (IllegalArgumentException | IndexOutOfBoundsException ignored) { } catch (IllegalArgumentException | IndexOutOfBoundsException ignored) {

View File

@ -700,6 +700,8 @@ public class Commandessentials extends EssentialsCommand {
} }
ess.getLogger().info("Found " + total + " orphaned userdata files."); 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 { } else {
try { try {
final UUID uuid = UUID.fromString(args[1]); final UUID uuid = UUID.fromString(args[1]);

View File

@ -1462,6 +1462,7 @@ userIsAwaySelfWithMessage=\u00a77You are now AFK.
userIsNotAwaySelf=\u00a77You are no longer AFK. userIsNotAwaySelf=\u00a77You are no longer AFK.
userJailed=\u00a76You have been jailed\! userJailed=\u00a76You have been jailed\!
usermapEntry=\u00a7c{0} \u00a76is mapped to \u00a7c{1}\u00a76. 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} 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. 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. userUnknown=\u00a74Warning\: The user ''\u00a7c{0}\u00a74'' has never joined this server.