Skip to content

Commit

Permalink
Add NameManager.getUUIDForFullName
Browse files Browse the repository at this point in the history
  • Loading branch information
Brokkonaut committed Sep 1, 2021
1 parent eff32a1 commit 2745bff
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/com/Acrobot/ChestShop/UUIDs/NameManager.java
Expand Up @@ -31,6 +31,7 @@ public class NameManager {
private static Map<String, UUID> usedShortNames = new HashMap<String, UUID>();
private static Map<UUID, String> currentShortName = new HashMap<UUID, String>();
private static Map<UUID, String> lastSeenFullName = new HashMap<UUID, String>();
private static Map<String, UUID> fullNamesToUUID = new HashMap<String, UUID>();

private static UUID adminShopUUID;
private static UUID serverAccountUUID;
Expand Down Expand Up @@ -59,6 +60,10 @@ public static UUID getUUIDFor(String shortName) {
return usedShortNames.get(shortName.toLowerCase());
}

public static UUID getUUIDForFullName(String name) {
return fullNamesToUUID.get(name.toLowerCase());
}

private static String createUseableShortName(String name, int id) {
if (id == 0) {
return name.length() > 15 ? name.substring(0, 15) : name;
Expand Down Expand Up @@ -126,6 +131,7 @@ private static String storeUsername(final UUID uuid, String name) {
e.printStackTrace();
}
}
fullNamesToUUID.put(name.toLowerCase(), uuid);
return foundShortName;
}

Expand Down Expand Up @@ -168,6 +174,7 @@ public static void load() {

for (PlayerName pn : playerNames.queryForAll()) {
lastSeenFullName.put(pn.getUuid(), pn.getFullName());
fullNamesToUUID.put(pn.getFullName().toLowerCase(), pn.getUuid());
}
for (Account2 a : accounts2.queryForAll()) {
UUID id = a.getUuid();
Expand Down

0 comments on commit 2745bff

Please sign in to comment.