Search in sources :

Example 1 with StoredUserEntryAccessor

use of org.spongepowered.common.accessor.server.players.StoredUserEntryAccessor in project SpongeCommon by SpongePowered.

the class SpongeWhitelistService method whitelistedProfiles.

@SuppressWarnings("unchecked")
@Override
public CompletableFuture<Collection<GameProfile>> whitelistedProfiles() {
    final List<GameProfile> profiles = new ArrayList<>();
    final UserWhiteList list = SpongeCommon.server().getPlayerList().getWhiteList();
    for (final UserWhiteListEntry entry : ((StoredUserListAccessor<com.mojang.authlib.GameProfile, UserWhiteListEntry>) list).accessor$map().values()) {
        profiles.add(SpongeGameProfile.of(((StoredUserEntryAccessor<com.mojang.authlib.GameProfile>) entry).accessor$user()));
    }
    return CompletableFuture.completedFuture(profiles);
}
Also used : UserWhiteList(net.minecraft.server.players.UserWhiteList) SpongeGameProfile(org.spongepowered.common.profile.SpongeGameProfile) GameProfile(org.spongepowered.api.profile.GameProfile) ArrayList(java.util.ArrayList) UserWhiteListEntry(net.minecraft.server.players.UserWhiteListEntry) StoredUserEntryAccessor(org.spongepowered.common.accessor.server.players.StoredUserEntryAccessor)

Aggregations

ArrayList (java.util.ArrayList)1 UserWhiteList (net.minecraft.server.players.UserWhiteList)1 UserWhiteListEntry (net.minecraft.server.players.UserWhiteListEntry)1 GameProfile (org.spongepowered.api.profile.GameProfile)1 StoredUserEntryAccessor (org.spongepowered.common.accessor.server.players.StoredUserEntryAccessor)1 SpongeGameProfile (org.spongepowered.common.profile.SpongeGameProfile)1