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 SocketPlayer
Creates a newSocketPlayer
object and caches it.static @NotNull SocketPlayer
Creates a newSocketPlayer
object and caches it.static @NotNull SocketPlayer
createIfAbsent
(@NotNull UUID pid) Creates a newSocketPlayer
object and caches it if one does not already exist.static @NotNull SocketPlayer
Creates a newSocketPlayer
object and caches it if one does not already exist.static @Nullable SocketPlayer
Gets aSocketPlayer
object from the cache.static @Nullable SocketPlayer
Gets aSocketPlayer
object from the cache.static void
Removes aSocketPlayer
object from the cache.static void
Removes aSocketPlayer
object from the cache.
-
Method Details
-
get
Gets aSocketPlayer
object from the cache.- Parameters:
pid
- The UUID of the player to get the object for.- Returns:
- The
SocketPlayer
object, or null if the player is not in the cache.
-
get
Gets aSocketPlayer
object from the cache.- Parameters:
p
- The player to get the object for.- Returns:
- The
SocketPlayer
object, or null if the player is not in the cache.
-
create
Creates a newSocketPlayer
object 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
SocketPlayer
object.
-
create
Creates a newSocketPlayer
object and caches it. This will remove any existing object for the player.- Parameters:
p
- The player to create the object for.- Returns:
- The new
SocketPlayer
object.
-
createIfAbsent
Creates a newSocketPlayer
object and caches it if one does not already exist.- Parameters:
pid
- The UUID of the player to create the object for.- Returns:
- The
SocketPlayer
object.
-
createIfAbsent
Creates a newSocketPlayer
object and caches it if one does not already exist.- Parameters:
p
- The player to create the object for.- Returns:
- The
SocketPlayer
object.
-
remove
Removes aSocketPlayer
object from the cache.- Parameters:
pid
- The UUID of the player to remove the object for.
-
remove
Removes aSocketPlayer
object from the cache.- Parameters:
p
- The player to remove the object for.
-