Interface PacketInjector

All Known Implementing Classes:
AbstractPacketInjector

public interface PacketInjector
Represents an incoming packet injector.
  • Method Details

    • addPacketHandler

      boolean addPacketHandler(PacketType type, Set<ListenerOptions> options)
      Start intercepting packets with the given packet type.
      Parameters:
      type - - the type of the packets to start intercepting.
      options - - any listener options.
      Returns:
      TRUE if we didn't already intercept these packets, FALSE otherwise.
    • removePacketHandler

      boolean removePacketHandler(PacketType type)
      Stop intercepting packets with the given packet type.
      Parameters:
      type - - the type of the packets to stop intercepting.
      Returns:
      TRUE if we successfuly stopped intercepting a given packet ID, FALSE otherwise.
    • hasPacketHandler

      boolean hasPacketHandler(PacketType type)
      Determine if packets with the given packet type is being intercepted.
      Parameters:
      type - - the packet type to lookup.
      Returns:
      TRUE if we do, FALSE otherwise.
    • getPacketHandlers

      Set<PacketType> getPacketHandlers()
      Retrieve every intercepted packet type.
      Returns:
      Every intercepted packet type.
    • packetReceived

      PacketEvent packetReceived(PacketContainer packet, org.bukkit.entity.Player client)
      Let the packet listeners process the given packet.
      Parameters:
      packet - - a packet to process.
      client - - the client that sent the packet.
      Returns:
      The resulting packet event.
    • hasMainThreadListener

      boolean hasMainThreadListener(PacketType type)
      Determine if we have packet listeners with the given type that must be executed on the main thread.
      Parameters:
      type - - the packet type.
      Returns:
      TRUE if we do, FALSE otherwise.
    • cleanupAll

      void cleanupAll()
      Perform any necessary cleanup before unloading ProtocolLib.