Interface SocketInjector
- All Known Implementing Classes:
BukkitSocketInjector,ChannelInjector.ChannelSocketInjector
public interface SocketInjector
Represents an injector that only gives access to a player's socket.
- Author:
- Kristian
-
Method Summary
Modifier and TypeMethodDescriptionvoiddisconnect(String message)Attempt to disconnect the current client.Retrieve the associated address of this player.org.bukkit.entity.PlayerRetrieve the hooked player.Deprecated.May be null on certain server implementations.org.bukkit.entity.PlayerRetrieve the hooked player object OR the more up-to-date player instance.booleanDetermines if the player is currently connected.voidsendServerPacket(Object packet, NetworkMarker marker, boolean filtered)Send a packet to the client.voidsetUpdatedPlayer(org.bukkit.entity.Player updatedPlayer)Set the real Bukkit player that we will use.voidtransferState(SocketInjector delegate)Invoked when a delegated socket injector transfers the state of one injector to the next.
-
Method Details
-
getSocket
Deprecated.May be null on certain server implementations. Also don't use raw sockets.Retrieve the associated socket of this player.- Returns:
- The associated socket.
- Throws:
IllegalAccessException- If we're unable to read the socket field.
-
getAddress
Retrieve the associated address of this player.- Returns:
- The associated address.
- Throws:
IllegalAccessException- If we're unable to read the socket field.
-
disconnect
Attempt to disconnect the current client.- Parameters:
message- - the message to display.- Throws:
InvocationTargetException- If disconnection failed.
-
sendServerPacket
void sendServerPacket(Object packet, NetworkMarker marker, boolean filtered) throws InvocationTargetExceptionSend a packet to the client.- Parameters:
packet- - server packet to send.marker- - the network marker.filtered- - whether or not the packet will be filtered by our listeners.- Throws:
InvocationTargetException- If an error occured when sending the packet.
-
getPlayer
org.bukkit.entity.Player getPlayer()Retrieve the hooked player.- Returns:
- The hooked player.
-
getUpdatedPlayer
org.bukkit.entity.Player getUpdatedPlayer()Retrieve the hooked player object OR the more up-to-date player instance.- Returns:
- The hooked player, or a more up-to-date instance.
-
transferState
Invoked when a delegated socket injector transfers the state of one injector to the next.- Parameters:
delegate- - the new injector.
-
setUpdatedPlayer
void setUpdatedPlayer(org.bukkit.entity.Player updatedPlayer)Set the real Bukkit player that we will use.- Parameters:
updatedPlayer- - the real Bukkit player.
-
isConnected
boolean isConnected()Determines if the player is currently connected.- Returns:
- true if the player is connected.
-