Package xyz.gmitch215.socketmc.spigot
Class SocketPlayerRegistry
java.lang.Object
xyz.gmitch215.socketmc.spigot.SocketPlayerRegistry
Thread-safe utility class for caching a
SocketPlayer object.-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull SocketPlayerCreates a newSocketPlayerobject and caches it.static @NotNull SocketPlayerCreates a newSocketPlayerobject and caches it.static @NotNull SocketPlayercreateIfAbsent(@NotNull UUID pid) Creates a newSocketPlayerobject and caches it if one does not already exist.static @NotNull SocketPlayerCreates a newSocketPlayerobject and caches it if one does not already exist.static @Nullable SocketPlayerGets aSocketPlayerobject from the cache.static @Nullable SocketPlayerGets aSocketPlayerobject from the cache.static voidRemoves aSocketPlayerobject from the cache.static voidRemoves aSocketPlayerobject from the cache.
-
Method Details
-
get
Gets aSocketPlayerobject from the cache.- Parameters:
pid- The UUID of the player to get the object for.- Returns:
- The
SocketPlayerobject, or null if the player is not in the cache.
-
get
Gets aSocketPlayerobject from the cache.- Parameters:
p- The player to get the object for.- Returns:
- The
SocketPlayerobject, or null if the player is not in the cache.
-
create
Creates a newSocketPlayerobject and caches it. This will remove any existing object for the player.- Parameters:
pid- The UUID of the player to create the object for.- Returns:
- The new
SocketPlayerobject.
-
create
Creates a newSocketPlayerobject and caches it. This will remove any existing object for the player.- Parameters:
p- The player to create the object for.- Returns:
- The new
SocketPlayerobject.
-
createIfAbsent
Creates a newSocketPlayerobject and caches it if one does not already exist.- Parameters:
pid- The UUID of the player to create the object for.- Returns:
- The
SocketPlayerobject.
-
createIfAbsent
Creates a newSocketPlayerobject and caches it if one does not already exist.- Parameters:
p- The player to create the object for.- Returns:
- The
SocketPlayerobject.
-
remove
Removes aSocketPlayerobject from the cache.- Parameters:
pid- The UUID of the player to remove the object for.
-
remove
Removes aSocketPlayerobject from the cache.- Parameters:
p- The player to remove the object for.
-