类 UsernameCache
java.lang.Object
net.neoforged.neoforge.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.
-
嵌套类概要
嵌套类修饰符和类型类说明private static class
Used for saving theGson
representation of the cache to disk -
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static boolean
containsUUID
(UUID uuid) Check if the cache contains the given player's usernamestatic @Nullable String
getLastKnownUsername
(UUID uuid) Get the player's last known usernamegetMap()
Get an immutable copy of the cache's underlying mapprotected static void
load()
Load the cache from fileprotected static boolean
removeUsername
(UUID uuid) Remove a player's username from the cacheprotected static void
save()
Save the cache to fileprotected static void
setUsername
(UUID uuid, String username) Set a player's current usernamee
-
字段详细资料
-
map
-
saveFile
-
gson
private static final com.google.gson.Gson gson -
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER -
USRCACHE
private static final org.apache.logging.log4j.Marker USRCACHE
-
-
构造器详细资料
-
UsernameCache
private UsernameCache()
-
-
方法详细资料
-
setUsername
Set a player's current usernamee- 参数:
uuid
- the player'sUUID
username
- the player's username
-
removeUsername
Remove a player's username from the cache- 参数:
uuid
- the player'sUUID
- 返回:
- if the cache contained the user
-
getLastKnownUsername
Get the player's last known usernameMay be
null
- 参数:
uuid
- the player'sUUID
- 返回:
- the player's last known username, or
null
if the cache doesn't have a record of the last username
-
containsUUID
Check if the cache contains the given player's username- 参数:
uuid
- the player'sUUID
- 返回:
- if the cache contains a username for the given player
-
getMap
Get an immutable copy of the cache's underlying map- 返回:
- the map
-
save
protected static void save()Save the cache to file -
load
protected static void load()Load the cache from file
-