Interface Injector
- All Known Implementing Classes:
ChannelInjector,ClosedInjector
public interface Injector
Represents an injected client connection.
- Author:
- Kristian
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the current injector.Retrieve the current protocol state.Retrieve the network marker associated with a given packet.org.bukkit.entity.PlayerRetrieve the current player or temporary player associated with the injector.intRetrieve the current protocol version of the player.booleaninject()Inject the current channel.booleanisClosed()Determine if this channel has been closed and cleaned up.booleanDetermine if the channel has already been injected.voidrecieveClientPacket(Object packet)Recieve a packet on the server.voidsaveMarker(Object packet, NetworkMarker marker)Associate a given network marker with a specific packet.voidsendServerPacket(Object packet, NetworkMarker marker, boolean filtered)Send a packet to a player's client.voidsetPlayer(org.bukkit.entity.Player player)Set the current player instance.voidsetUpdatedPlayer(org.bukkit.entity.Player player)Set the updated player instance.
-
Method Details
-
getProtocolVersion
int getProtocolVersion()Retrieve the current protocol version of the player.- Returns:
- Protocol version.
-
inject
boolean inject()Inject the current channel.Note that only active channels can be injected.
- Returns:
- TRUE if we injected the channel, false if we could not inject or it was already injected.
-
close
void close()Close the current injector. -
sendServerPacket
Send a packet to a player's client.- Parameters:
packet- - the packet to send.marker- - the network marker.filtered- - whether or not the packet is filtered.
-
recieveClientPacket
Recieve a packet on the server.- Parameters:
packet- - the (NMS) packet to send.
-
getCurrentProtocol
PacketType.Protocol getCurrentProtocol()Retrieve the current protocol state.- Returns:
- The current protocol.
-
getMarker
Retrieve the network marker associated with a given packet.- Parameters:
packet- - the packet.- Returns:
- The network marker.
-
saveMarker
Associate a given network marker with a specific packet.- Parameters:
packet- - the NMS packet.marker- - the associated marker.
-
getPlayer
org.bukkit.entity.Player getPlayer()Retrieve the current player or temporary player associated with the injector.- Returns:
- The current player.
-
setPlayer
void setPlayer(org.bukkit.entity.Player player)Set the current player instance.- Parameters:
player- - the current player.
-
isInjected
boolean isInjected()Determine if the channel has already been injected.- Returns:
- TRUE if it has, FALSE otherwise.
-
isClosed
boolean isClosed()Determine if this channel has been closed and cleaned up.- Returns:
- TRUE if it has, FALSE otherwise.
-
setUpdatedPlayer
void setUpdatedPlayer(org.bukkit.entity.Player player)Set the updated player instance.This will not replace the current instance, but it will allow PacketEvent to provide additional player information.
- Parameters:
player- - the more up-to-date player.
-