use of org.lanternpowered.server.config.user.ban.BanConfig in project LanternServer by LanternPowered.
the class LanternUserStorageService method getFromBanService.
/**
* Attempts to get a {@link User} from the {@link BanService}.
*
* @param uniqueId The unique id
* @return The user
*/
@Nullable
private ProxyUser getFromBanService(UUID uniqueId) {
final LanternGameProfile gameProfile;
final BanService banService = this.banService.get();
if (banService instanceof BanConfig) {
gameProfile = ((BanConfig) banService).getEntryByUUID(uniqueId).map(entry -> ((BanEntry.Profile) entry).getProfile()).orElse(null);
} else {
gameProfile = banService.getBanFor(new LanternGameProfile(uniqueId, null)).map(entry -> ((BanEntry.Profile) entry).getProfile()).orElse(null);
}
return gameProfile == null ? null : new ProxyUser(gameProfile);
}
Aggregations