Interface Injector

All Known Implementing Classes:
ChannelInjector, ClosedInjector

public interface Injector
Represents an injected client connection.
Author:
Kristian
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Close the current injector.
    Retrieve the current protocol state.
    getMarker​(Object packet)
    Retrieve the network marker associated with a given packet.
    org.bukkit.entity.Player
    Retrieve the current player or temporary player associated with the injector.
    int
    Retrieve the current protocol version of the player.
    boolean
    Inject the current channel.
    boolean
    Determine if this channel has been closed and cleaned up.
    boolean
    Determine if the channel has already been injected.
    void
    Recieve a packet on the server.
    void
    saveMarker​(Object packet, NetworkMarker marker)
    Associate a given network marker with a specific packet.
    void
    sendServerPacket​(Object packet, NetworkMarker marker, boolean filtered)
    Send a packet to a player's client.
    void
    setPlayer​(org.bukkit.entity.Player player)
    Set the current player instance.
    void
    setUpdatedPlayer​(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

      void sendServerPacket(Object packet, NetworkMarker marker, boolean filtered)
      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

      void recieveClientPacket(Object packet)
      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

      NetworkMarker getMarker(Object packet)
      Retrieve the network marker associated with a given packet.
      Parameters:
      packet - - the packet.
      Returns:
      The network marker.
    • saveMarker

      void saveMarker(Object packet, NetworkMarker marker)
      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.