Package net.minecraftforge.common
Class UsernameCache
java.lang.Object
net.minecraftforge.common.UsernameCache
Caches player's last known usernames
 
 Modders should use getLastKnownUsername(UUID) to determine a players
 last known username.
 For convenience, getMap() is provided to get an immutable copy of
 the caches underlying map.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprivate static classUsed for saving theGsonrepresentation of the cache to disk
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic booleancontainsUUID(UUID uuid) Check if the cache contains the given player's usernamestatic StringgetLastKnownUsername(UUID uuid) Get the player's last known usernamegetMap()Get an immutable copy of the cache's underlying mapprotected static voidload()Load the cache from fileprotected static booleanremoveUsername(UUID uuid) Remove a player's username from the cacheprotected static voidsave()Save the cache to fileprotected static voidsetUsername(UUID uuid, String username) Set a player's current usernamee
- 
Field Details- 
map
- 
saveFile
- 
gsonprivate static final com.google.gson.Gson gson
- 
LOGGERprivate static final org.apache.logging.log4j.Logger LOGGER
- 
USRCACHEprivate static final org.apache.logging.log4j.Marker USRCACHE
 
- 
- 
Constructor Details- 
UsernameCacheprivate UsernameCache()
 
- 
- 
Method Details- 
setUsernameSet a player's current usernamee- Parameters:
- uuid- the player's- UUID
- username- the player's username
 
- 
removeUsernameRemove a player's username from the cache- Parameters:
- uuid- the player's- UUID
- Returns:
- if the cache contained the user
 
- 
getLastKnownUsernameGet the player's last known usernameMay be null- Parameters:
- uuid- the player's- UUID
- Returns:
- the player's last known username, or nullif the cache doesn't have a record of the last username
 
- 
containsUUIDCheck if the cache contains the given player's username- Parameters:
- uuid- the player's- UUID
- Returns:
- if the cache contains a username for the given player
 
- 
getMapGet an immutable copy of the cache's underlying map- Returns:
- the map
 
- 
saveprotected static void save()Save the cache to file
- 
loadprotected static void load()Load the cache from file
 
-