More helpful error message when user is null in API PlayerAdapter (#3104)

This commit is contained in:
Luck 2021-07-18 20:38:06 +01:00
parent 5a377e713e
commit 5ea2aee2f4
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -57,7 +57,9 @@ public class ApiPlayerAdapter<S, P extends S> implements PlayerAdapter<P> {
public @NonNull User getUser(@NonNull P player) {
Objects.requireNonNull(player, "player");
me.lucko.luckperms.common.model.User user = this.userManager.getIfLoaded(this.contextManager.getUniqueId(checkType(player)));
Objects.requireNonNull(user, "user");
if (user == null) {
throw new IllegalStateException("Unable to get a user for " + player);
}
return user.getApiProxy();
}