Interface ICommonPacketListener

All Superinterfaces:
PacketListener
All Known Subinterfaces:
ClientCommonPacketListener, ClientConfigurationPacketListener, ClientGamePacketListener, IClientCommonPacketListenerExtension, IServerCommonPacketListenerExtension, IServerConfigurationPacketListenerExtension, IServerGamePacketListenerExtension, ServerCommonPacketListener, ServerConfigurationPacketListener, ServerGamePacketListener
All Known Implementing Classes:
ClientCommonPacketListenerImpl, ClientConfigurationPacketListenerImpl, ClientPacketListener, FakePlayer.FakePlayerNetHandler, ServerCommonPacketListenerImpl, ServerConfigurationPacketListenerImpl, ServerGamePacketListenerImpl

public interface ICommonPacketListener extends PacketListener
Extension interface and functionality hoist for both ServerCommonPacketListener and ClientCommonPacketListener.
  • Method Details

    • send

      void send(Packet<?> packet)
      Sends a packet to the target of this listener.
    • send

      void send(CustomPacketPayload payload)
      Sends a payload to the target of this listener.
    • disconnect

      void disconnect(Component reason)
      Triggers a disconnection with the given reason.
      Parameters:
      reason - The reason for the disconnection
    • getConnection

      Connection getConnection()
      Returns the connection this listener is attached to.
      Returns:
      the connection this listener is attached to
    • getMainThreadEventLoop

      ReentrantBlockableEventLoop<?> getMainThreadEventLoop()
      Returns the main thread event loop.
      Returns:
      the main thread event loop
    • hasChannel

      default boolean hasChannel(ResourceLocation payloadId)
      Checks if the connection has negotiated and opened a channel for the payload.
      Parameters:
      payloadId - The payload id to check
    • hasChannel

      default boolean hasChannel(CustomPacketPayload.Type<?> type)
    • hasChannel

      default boolean hasChannel(CustomPacketPayload payload)
    • getConnectionType

      ConnectionType getConnectionType()
      Returns the connection type of this packet listener.
      Returns:
      the connection type of this packet listener