Package xyz.gmitch215.socketmc.spigot
Class SocketPlayer
java.lang.Object
xyz.gmitch215.socketmc.spigot.SocketPlayer
Represents a player connected to the server with SocketMC installed.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the netty channel connecting the player to the server.Gets the player associated with this SocketPlayer instance.Gets the retriever for this SocketPlayer.void
ping()
Sends aInstruction.PING
instruction.static void
Registers the packet injector for the player.void
sendInstruction
(@NotNull Instruction i, @NotNull Plugin plugin) Sends an instruction to the player.void
sendInstruction
(@NotNull Instruction i, @NotNull SocketPlugin plugin) Sends an instruction to the player.
-
Field Details
-
PACKET_INJECTOR_ID
The ID of the packet injector.- See Also:
-
-
Constructor Details
-
SocketPlayer
Creates a new SocketPlayer instance.- Parameters:
p
- The player to create the instance for.- Throws:
SocketMCNotInstalledException
- if the player does not have SocketMC installed
-
-
Method Details
-
getPlayer
Gets the player associated with this SocketPlayer instance.- Returns:
- Player
-
getChannel
Gets the netty channel connecting the player to the server.- Returns:
- Network Channel
-
ping
public void ping()Sends aInstruction.PING
instruction. -
sendInstruction
public void sendInstruction(@NotNull @NotNull Instruction i, @NotNull @NotNull Plugin plugin) throws SocketMCNotInstalledException Sends an instruction to the player.- Parameters:
i
- The instruction to send.plugin
- The plugin sending the instruction.- Throws:
SocketMCNotInstalledException
- if the player does not have SocketMC installed
-
sendInstruction
public void sendInstruction(@NotNull @NotNull Instruction i, @NotNull @NotNull SocketPlugin plugin) throws SocketMCNotInstalledException, FailedInstructionException Sends an instruction to the player.- Parameters:
i
- The instruction to send.plugin
- The plugin sending the instruction.- Throws:
SocketMCNotInstalledException
- if the player does not have SocketMC installedFailedInstructionException
- if the instruction fails to send- See Also:
-
getRetriever
Gets the retriever for this SocketPlayer.- Returns:
- Socket Retriever
-
registerEvents
Registers the packet injector for the player. Please note that aInstruction.PING
instruction must be sent at least once in order for the client to start sending events.- Parameters:
p
- The player to register the events for.
-