Package org.spongepowered.api.profile
Interface GameProfileCache
-
public interface GameProfileCache
Represents a cache of profile data.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Collection<GameProfile>
all()
Gets a collection of all cachedGameProfile
s.java.util.Collection<GameProfile>
allMatches(java.lang.String name)
Returns a collection of matching cachedGameProfile
s whose last known names start with the given string (case-insensitive).void
clear()
Clears all the entries from this cache.java.util.Optional<GameProfile>
findById(java.util.UUID uniqueId)
Gets aGameProfile
from this cache by its unique id.java.util.Map<java.util.UUID,java.util.Optional<GameProfile>>
findByIds(java.lang.Iterable<java.util.UUID> uniqueIds)
GetsGameProfile
s in bulk by their unique id.java.util.Optional<GameProfile>
findByName(java.lang.String name)
Gets aGameProfile
from this cache by its name.java.util.Map<java.lang.String,java.util.Optional<GameProfile>>
findByNames(java.lang.Iterable<java.lang.String> names)
GetsGameProfile
s in bulk by their name.java.util.Collection<GameProfile>
remove(java.lang.Iterable<GameProfile> profiles)
Remove entries from this cache in bulk.boolean
remove(GameProfile profile)
Remove entries from this cache in bulk.java.util.Collection<GameProfile>
removeIf(java.util.function.Predicate<GameProfile> filter)
Remove entries from this cache in bulk.java.util.stream.Stream<GameProfile>
stream()
Gets aStream
of all cachedGameProfile
s.java.util.stream.Stream<GameProfile>
streamOfMatches(java.lang.String name)
Returns a stream of matching cachedGameProfile
s 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
java.util.Collection<GameProfile> remove(java.lang.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
java.util.Collection<GameProfile> removeIf(java.util.function.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
java.util.Optional<GameProfile> findById(java.util.UUID uniqueId)
Gets aGameProfile
from 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
java.util.Map<java.util.UUID,java.util.Optional<GameProfile>> findByIds(java.lang.Iterable<java.util.UUID> uniqueIds)
GetsGameProfile
s in bulk by their unique id.- Parameters:
uniqueIds
- The unique ids- Returns:
- A collection of successfully found up profiles
-
findByName
java.util.Optional<GameProfile> findByName(java.lang.String name)
Gets aGameProfile
from 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
java.util.Map<java.lang.String,java.util.Optional<GameProfile>> findByNames(java.lang.Iterable<java.lang.String> names)
GetsGameProfile
s in bulk by their name.- Parameters:
names
- The names- Returns:
- A collection of successfully found up profiles
-
all
java.util.Collection<GameProfile> all()
Gets a collection of all cachedGameProfile
s.- Returns:
- A
Collection
of cachedGameProfile
s
-
stream
java.util.stream.Stream<GameProfile> stream()
Gets aStream
of all cachedGameProfile
s.- Returns:
- A
Stream
of cachedGameProfile
s
-
allMatches
java.util.Collection<GameProfile> allMatches(java.lang.String name)
Returns a collection of matching cachedGameProfile
s 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
User
data,UserManager.streamOfMatches(String)
should be used instead.- Parameters:
name
- The name- Returns:
- A
Collection
of matchingGameProfile
s
-
streamOfMatches
java.util.stream.Stream<GameProfile> streamOfMatches(java.lang.String name)
Returns a stream of matching cachedGameProfile
s 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
User
data,UserManager.streamOfMatches(String)
should be used instead.- Parameters:
name
- The name- Returns:
- A
Stream
of matchingGameProfile
s
-
-