Package xyz.gmitch215.socketmc.spigot
Class SocketRetriever
java.lang.Object
xyz.gmitch215.socketmc.spigot.SocketRetriever
The retriever handler for a
SocketPlayer
.-
Method Summary
Modifier and TypeMethodDescriptiongetBus()
Gets an immutable copy of this SocketRetriever's method bus.Gets the player associated with this retriever.retrieve
(@NotNull RetrieverType<T> r, @NotNull Consumer<@Nullable T> callback, @NotNull Plugin plugin) Retrieves information from the client.retrieve
(@NotNull RetrieverType<T> r, @NotNull Consumer<@Nullable T> callback, @NotNull SocketPlugin plugin) Retrieves information from the client.
-
Method Details
-
getBus
Gets an immutable copy of this SocketRetriever's method bus.
Internally, the UUID generated with the retriever method is passed with the retriever type, and the consumer is not serialized and kept here. Then, once the mod successfully retrieves the requested information, the consumer is called based on the UUID mapped to it. The consumer does not need to be serializable.
- Returns:
- An immutable copy of this SocketRetriever's method bus
-
getPlayer
Gets the player associated with this retriever.- Returns:
- The player associated with this retriever
-
retrieve
@NotNull public <T> @NotNull UUID retrieve(@NotNull @NotNull RetrieverType<T> r, @NotNull @NotNull Consumer<@Nullable T> callback, @NotNull @NotNull Plugin plugin) throws FailedInstructionException Retrieves information from the client.- Type Parameters:
T
- The type of the retriever- Parameters:
r
- The retriever typecallback
- The callback to be called when the information is retrievedplugin
- The plugin to retrieve the information for- Returns:
- The identifier of the request, to be stored in
getBus()
. - Throws:
FailedInstructionException
- if the instruction fails to send
-
retrieve
@NotNull public <T> @NotNull UUID retrieve(@NotNull @NotNull RetrieverType<T> r, @NotNull @NotNull Consumer<@Nullable T> callback, @NotNull @NotNull SocketPlugin plugin) throws FailedInstructionException Retrieves information from the client.- Type Parameters:
T
- The type of the retriever- Parameters:
r
- The retriever typecallback
- The callback to be called when the information is retrievedplugin
- The plugin to retrieve the information for- Returns:
- The identifier of the request, to be stored in
getBus()
. - Throws:
FailedInstructionException
- if the instruction fails to send
-