Skip to content

Commit

Permalink
Another fix for name lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
pop4959 committed Oct 10, 2024
1 parent 06be778 commit 8d76e73
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bukkit/src/main/java/org/popcraft/bolt/util/Profiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ public static CompletableFuture<Profile> lookupProfileByName(final String name)
if (name == null || name.isEmpty() || NIL_UUID_STRING.equals(name) || name.length() > MAX_NAME_LENGTH || KNOWN_NULL_LOOKUPS_BY_NAME.contains(name)) {
return CompletableFuture.completedFuture(SimpleProfileCache.EMPTY_PROFILE);
}
final PlayerProfile playerProfile = Bukkit.createPlayerProfile(name);
final PlayerProfile playerProfile;
try {
playerProfile = Bukkit.createPlayerProfile(name);
} catch (final IllegalArgumentException ignored) {
return CompletableFuture.completedFuture(SimpleProfileCache.EMPTY_PROFILE);
}
final CompletableFuture<PlayerProfile> updatedProfile = playerProfile.update();
final ProfileCache profileCache = JavaPlugin.getPlugin(BoltPlugin.class).getProfileCache();
updatedProfile.thenAccept(profile -> {
Expand Down Expand Up @@ -98,7 +103,12 @@ public static CompletableFuture<Profile> lookupProfileByUniqueId(final UUID uuid
if (uuid == null || NIL_UUID.equals(uuid) || KNOWN_NULL_LOOKUPS_BY_UUID.contains(uuid)) {
return CompletableFuture.completedFuture(SimpleProfileCache.EMPTY_PROFILE);
}
final PlayerProfile playerProfile = Bukkit.createPlayerProfile(uuid);
final PlayerProfile playerProfile;
try {
playerProfile = Bukkit.createPlayerProfile(uuid);
} catch (final IllegalArgumentException ignored) {
return CompletableFuture.completedFuture(SimpleProfileCache.EMPTY_PROFILE);
}
final CompletableFuture<PlayerProfile> updatedProfile = playerProfile.update();
final ProfileCache profileCache = JavaPlugin.getPlugin(BoltPlugin.class).getProfileCache();
updatedProfile.thenAccept(profile -> {
Expand Down

0 comments on commit 8d76e73

Please sign in to comment.