Package org.spongepowered.api.profile
Interface GameProfileCache
-
public interface GameProfileCacheRepresents a cache of profile data.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Collection<GameProfile>all()Gets a collection of all cachedGameProfiles.Collection<GameProfile>allMatches(String name)Returns a collection of matching cachedGameProfiles whose last known names start with the given string (case-insensitive).voidclear()Clears all the entries from this cache.Optional<GameProfile>findById(UUID uniqueId)Gets aGameProfilefrom this cache by its unique id.Map<UUID,Optional<GameProfile>>findByIds(Iterable<UUID> uniqueIds)GetsGameProfiles in bulk by their unique id.Optional<GameProfile>findByName(String name)Gets aGameProfilefrom this cache by its name.Map<String,Optional<GameProfile>>findByNames(Iterable<String> names)GetsGameProfiles in bulk by their name.Collection<GameProfile>remove(Iterable<GameProfile> profiles)Remove entries from this cache in bulk.booleanremove(GameProfile profile)Remove entries from this cache in bulk.Collection<GameProfile>removeIf(Predicate<GameProfile> filter)Remove entries from this cache in bulk.Stream<GameProfile>stream()Gets aStreamof all cachedGameProfiles.Stream<GameProfile>streamOfMatches(String name)Returns a stream of matching cachedGameProfiles whose last known names start with the given string (case-insensitive).
-
-
-
Method Detail
-
remove
boolean remove(GameProfile profile)
Remove entries from this cache in bulk.- Parameters:
profile- The profile to remove from the cache- Returns:
- Whether the profile was successfully removed
-
remove
Collection<GameProfile> remove(Iterable<GameProfile> profiles)
Remove entries from this cache in bulk.- Parameters:
profiles- The profiles to remove from the cache- Returns:
- A collection of profiles successfully removed
-
removeIf
Collection<GameProfile> removeIf(Predicate<GameProfile> filter)
Remove entries from this cache in bulk.- Parameters:
filter- The filter which will be used to selected profiles to be removed- Returns:
- A collection of profiles successfully removed
-
clear
void clear()
Clears all the entries from this cache.
-
findById
Optional<GameProfile> findById(UUID uniqueId)
Gets aGameProfilefrom this cache by its unique id.- Parameters:
uniqueId- The unique id of the profile- Returns:
- The profile, if present, or
Optional.empty()if the cache did not contain a profile with the provided id
-
findByIds
Map<UUID,Optional<GameProfile>> findByIds(Iterable<UUID> uniqueIds)
GetsGameProfiles in bulk by their unique id.- Parameters:
uniqueIds- The unique ids- Returns:
- A collection of successfully found up profiles
-
findByName
Optional<GameProfile> findByName(String name)
Gets aGameProfilefrom this cache by its name.- Parameters:
name- The name of the profile- Returns:
- The profile, if present, or
Optional.empty()if the cache did not contain a profile with the provided name
-
findByNames
Map<String,Optional<GameProfile>> findByNames(Iterable<String> names)
GetsGameProfiles in bulk by their name.- Parameters:
names- The names- Returns:
- A collection of successfully found up profiles
-
all
Collection<GameProfile> all()
Gets a collection of all cachedGameProfiles.- Returns:
- A
Collectionof cachedGameProfiles
-
stream
Stream<GameProfile> stream()
Gets aStreamof all cachedGameProfiles.- Returns:
- A
Streamof cachedGameProfiles
-
allMatches
Collection<GameProfile> allMatches(String name)
Returns a collection of matching cachedGameProfiles whose last known names start with the given string (case-insensitive).This collection may also contain profiles of players who never played on the server. If you would prefer a collection or stream of known profiles that also have
Userdata,UserManager.streamOfMatches(String)should be used instead.- Parameters:
name- The name- Returns:
- A
Collectionof matchingGameProfiles
-
streamOfMatches
Stream<GameProfile> streamOfMatches(String name)
Returns a stream of matching cachedGameProfiles whose last known names start with the given string (case-insensitive).This stream may also return profiles of players who never played on the server. If you would prefer only known profiles that also have
Userdata,UserManager.streamOfMatches(String)should be used instead.- Parameters:
name- The name- Returns:
- A
Streamof matchingGameProfiles
-
-