use of org.spongepowered.common.profile.callback.MapProfileLookupCallback in project SpongeCommon by SpongePowered.
the class MixinPlayerProfileCache method lookupByNames.
@Override
public Map<String, Optional<GameProfile>> lookupByNames(Iterable<String> names) {
checkNotNull(names, "names");
Map<String, Optional<GameProfile>> result = Maps.newHashMap();
SpongeImpl.getServer().getGameProfileRepository().findProfilesByNames(Iterables.toArray(names, String.class), Agent.MINECRAFT, new MapProfileLookupCallback(result));
if (!result.isEmpty()) {
for (Optional<GameProfile> entry : result.values()) {
if (entry.isPresent()) {
this.addEntry((com.mojang.authlib.GameProfile) entry.get(), null);
}
}
return ImmutableMap.copyOf(result);
}
return ImmutableMap.of();
}
Aggregations