public interface GameProfileCache
GameProfile
s.Modifier and Type | Method and Description |
---|---|
default boolean |
add(GameProfile profile)
Add an entry to this cache.
|
default boolean |
add(GameProfile profile,
boolean overwrite,
Date expiry)
Deprecated.
|
boolean |
add(GameProfile profile,
boolean overwrite,
Instant expiry)
Add an entry to this cache, with an optional expiration date.
|
default boolean |
add(GameProfile profile,
Date expiry)
Deprecated.
|
default boolean |
add(GameProfile profile,
Instant expiry)
Add an entry to this cache, with an optional expiration date.
|
void |
clear()
Clear all entries from this cache.
|
default Optional<GameProfile> |
fillProfile(GameProfile profile)
Fills a
GameProfile from cached values. |
Optional<GameProfile> |
fillProfile(GameProfile profile,
boolean signed)
Fills a
GameProfile from cached values. |
Optional<GameProfile> |
getById(UUID uniqueId)
Gets a
GameProfile from this cache by its unique id. |
Map<UUID,Optional<GameProfile>> |
getByIds(Iterable<UUID> uniqueIds)
Gets
GameProfile s in bulk by their unique id. |
Optional<GameProfile> |
getByName(String name)
Gets a
GameProfile from this cache by its name. |
Map<String,Optional<GameProfile>> |
getByNames(Iterable<String> names)
Gets
GameProfile s in bulk by their name. |
Optional<GameProfile> |
getOrLookupById(UUID uniqueId)
Gets a
GameProfile from this cache by its id if available,
or lookups the profile by its unique id. |
Map<UUID,Optional<GameProfile>> |
getOrLookupByIds(Iterable<UUID> uniqueIds)
Gets
GameProfile s in bulk from this cache by when available,
and lookups the profiles by their unique id when not cached. |
Optional<GameProfile> |
getOrLookupByName(String name)
Gets a
GameProfile from this cache by its if available,
or lookups the profile by its name. |
Map<String,Optional<GameProfile>> |
getOrLookupByNames(Iterable<String> names)
Gets
GameProfile s in bulk from this cache by when available,
and lookups the profiles by their unique id when not cached. |
Collection<GameProfile> |
getProfiles()
Gets a collection of all cached
GameProfile s. |
Optional<GameProfile> |
lookupById(UUID uniqueId)
Looks a
GameProfile up by its unique id and
loads it into this cache. |
Map<UUID,Optional<GameProfile>> |
lookupByIds(Iterable<UUID> uniqueIds)
Looks up
GameProfile s in bulk by their unique id and
loads them into this cache. |
Optional<GameProfile> |
lookupByName(String name)
Looks a
GameProfile up by its name and
loads it into this cache. |
Map<String,Optional<GameProfile>> |
lookupByNames(Iterable<String> names)
Looks up
GameProfile s in bulk by their name and
loads them into this cache. |
Collection<GameProfile> |
match(String name)
Returns a collection of matching cached
GameProfile s whose last
known names start with the given string (case-insensitive). |
boolean |
remove(GameProfile profile)
Remove an entry from this cache.
|
Collection<GameProfile> |
remove(Iterable<GameProfile> profiles)
Remove entries from this cache in bulk.
|
default boolean add(GameProfile profile)
profile
- The profile to cachetrue
if the profile was successfully cached,
otherwise false
@Deprecated default boolean add(GameProfile profile, @Nullable Date expiry)
add(GameProfile, Instant)
profile
- The profile to cacheexpiry
- The expiration datetrue
if the profile was successfully cached,
otherwise false
default boolean add(GameProfile profile, @Nullable Instant expiry)
profile
- The profile to cacheexpiry
- The expiration datetrue
if the profile was successfully cached,
otherwise false
@Deprecated default boolean add(GameProfile profile, boolean overwrite, @Nullable Date expiry)
add(GameProfile, boolean, Instant)
profile
- The profile to cacheoverwrite
- If we should overwrite the cache entry for
the provided profileexpiry
- The expiration datetrue
if the profile was successfully cached,
otherwise false
boolean add(GameProfile profile, boolean overwrite, @Nullable Instant expiry)
profile
- The profile to cacheoverwrite
- If we should overwrite the cache entry for
the provided profileexpiry
- The expiration datetrue
if the profile was successfully cached,
otherwise false
boolean remove(GameProfile profile)
profile
- The profile to remove from the cachetrue
if the profile was successfully removed,
otherwise false
Collection<GameProfile> remove(Iterable<GameProfile> profiles)
profiles
- The profiles to remove from the cachevoid clear()
Optional<GameProfile> getById(UUID uniqueId)
GameProfile
from this cache by its unique id.uniqueId
- The unique id of the profileOptional.empty()
if
the cache did not contain a profile with the provided idMap<UUID,Optional<GameProfile>> getByIds(Iterable<UUID> uniqueIds)
GameProfile
s in bulk by their unique id.uniqueIds
- The unique idsOptional<GameProfile> lookupById(UUID uniqueId)
GameProfile
up by its unique id and
loads it into this cache.uniqueId
- The unique id of the profileOptional.empty()
if
we couldn't find a profile with the provided idMap<UUID,Optional<GameProfile>> lookupByIds(Iterable<UUID> uniqueIds)
GameProfile
s in bulk by their unique id and
loads them into this cache.uniqueIds
- The unique idsOptional<GameProfile> getOrLookupById(UUID uniqueId)
GameProfile
from this cache by its id if available,
or lookups the profile by its unique id.uniqueId
- The unique id of the profileOptional.empty()
if
the cache did not contain a profile with the provided id and
we couldn't lookup a profile with the provided idMap<UUID,Optional<GameProfile>> getOrLookupByIds(Iterable<UUID> uniqueIds)
GameProfile
s in bulk from this cache by when available,
and lookups the profiles by their unique id when not cached.uniqueIds
- The unique ids of the profilesOptional<GameProfile> getByName(String name)
GameProfile
from this cache by its name.name
- The name of the profileOptional.empty()
if
the cache did not contain a profile with the provided nameMap<String,Optional<GameProfile>> getByNames(Iterable<String> names)
GameProfile
s in bulk by their name.names
- The namesOptional<GameProfile> lookupByName(String name)
GameProfile
up by its name and
loads it into this cache.name
- The name of the profileOptional.empty()
if
we couldn't find a profile with the provided nameMap<String,Optional<GameProfile>> lookupByNames(Iterable<String> names)
GameProfile
s in bulk by their name and
loads them into this cache.names
- The namesOptional<GameProfile> getOrLookupByName(String name)
GameProfile
from this cache by its if available,
or lookups the profile by its name.name
- The name of the profileOptional.empty()
if
the cache did not contain a profile with the provided name and
we couldn't lookup a profile with the provided nameMap<String,Optional<GameProfile>> getOrLookupByNames(Iterable<String> names)
GameProfile
s in bulk from this cache by when available,
and lookups the profiles by their unique id when not cached.names
- The names of the profilesdefault Optional<GameProfile> fillProfile(GameProfile profile)
GameProfile
from cached values.profile
- The profile to fillOptional.empty()
if
we were unable to fill the profileOptional<GameProfile> fillProfile(GameProfile profile, boolean signed)
GameProfile
from cached values.profile
- The profile to fillsigned
- true if we should request that the profile data be signedOptional.empty()
if
we were unable to fill the profileCollection<GameProfile> getProfiles()
GameProfile
s.Collection
of cached GameProfile
sCollection<GameProfile> match(String name)
GameProfile
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!
Use UserStorageService.match(String)
for a collection that
only contains GameProfile
s with attached User
data.
This method only searches the local cache, so the data may not be up to date.
name
- The nameCollection
of matching GameProfile
s