Fix offline player consumer returning null users (#5339)

This commit is contained in:
Josh Roy 2023-05-06 19:13:44 -04:00 committed by GitHub
parent 069ebfcd5b
commit 7ebb6359e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,11 +30,16 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand {
final UUID uuid = StringUtil.toUUID(searchTerm);
if (uuid != null) {
final User matchedUser = ess.getUser(uuid);
if (matchedUser == null) {
throw new PlayerNotFoundException();
}
userConsumer.accept(matchedUser);
} else if (matchWildcards && searchTerm.contentEquals("**")) {
for (final UUID u : ess.getUsers().getAllUserUUIDs()) {
final User user = ess.getUsers().loadUncachedUser(u);
userConsumer.accept(user);
if (user != null) {
userConsumer.accept(user);
}
}
} else if (matchWildcards && searchTerm.contentEquals("*")) {
final boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).canInteractVanished();