接口 ICommonPacketListener

所有超级接口:
PacketListener
所有已知子接口:
ClientCommonPacketListener, ClientConfigurationPacketListener, ClientGamePacketListener, IClientCommonPacketListenerExtension, IServerCommonPacketListenerExtension, IServerConfigurationPacketListenerExtension, IServerGamePacketListenerExtension, ServerCommonPacketListener, ServerConfigurationPacketListener, ServerGamePacketListener
所有已知实现类:
FakePlayer.FakePlayerNetHandler, ServerCommonPacketListenerImpl, ServerConfigurationPacketListenerImpl, ServerGamePacketListenerImpl

public interface ICommonPacketListener extends PacketListener
Extension interface and functionality hoist for both ServerCommonPacketListener and ClientCommonPacketListener.
  • 方法详细资料

    • 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.
      参数:
      reason - The reason for the disconnection
    • getConnection

      Connection getConnection()
      返回 the connection this listener is attached to。
      返回:
      the connection this listener is attached to
    • getMainThreadEventLoop

      ReentrantBlockableEventLoop<?> getMainThreadEventLoop()
      返回 the main thread event loop。
      返回:
      the main thread event loop
    • hasChannel

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

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

      default boolean hasChannel(CustomPacketPayload payload)
    • getConnectionType

      ConnectionType getConnectionType()
      返回 the connection type of this packet listener。
      返回:
      the connection type of this packet listener