Interface ConnectionHandle


public interface ConnectionHandle
Stable handle for one native connection.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the exact runtime adapter identifier.
    default String
    Returns the latest language from client information forwarded to the server.
    Returns this connection's serialized event loop.
    void
    Flushes pending outbound writes.
    long
    id()
    Returns the sanitized connection identifier.
    Returns the authenticated identity scoped to this physical connection.
    Returns the currently observed inbound phase.
    boolean
    Reports whether the native connection remains open.
    Returns the currently observed outbound phase.
    void
    receive(Object nativePacket)
    Injects an already-decoded native serverbound packet through NativePackets listeners.
    void
    receiveSilently(Object nativePacket)
    Injects an already-decoded native serverbound packet after NativePackets listeners.
    void
    send(Object nativePacket)
    Writes a native clientbound packet and flushes the connection.
    default void
    send(Object owner, Object nativePacket, PacketSendCompletion completion)
    Writes, flushes, and reports actual transport completion for one lifecycle owner.
    void
    sendSilently(Object nativePacket)
    Writes and flushes while bypassing only NativePackets listeners.
    default void
    sendSilently(Object owner, Object nativePacket, PacketSendCompletion completion)
    Silently writes, flushes, and reports actual transport completion for one lifecycle owner.
    Returns the explicit connection/player lifecycle state.
    void
    write(Object nativePacket)
    Writes a native clientbound packet without forcing a flush.
    default void
    write(Object owner, Object nativePacket, PacketSendCompletion completion)
    Writes and reports completion after a later flush for one lifecycle owner.
    void
    writeSilently(Object nativePacket)
    Writes without flushing while bypassing only NativePackets listeners.
    default void
    writeSilently(Object owner, Object nativePacket, PacketSendCompletion completion)
    Silently writes and reports completion after a later flush for one lifecycle owner.
  • Method Details

    • id

      long id()
      Returns the sanitized connection identifier.
      Returns:
      connection identifier
    • adapterId

      String adapterId()
      Returns the exact runtime adapter identifier.
      Returns:
      adapter identifier
    • identity

      @Nullable default ConnectionIdentity identity()
      Returns the authenticated identity scoped to this physical connection.
      Returns:
      identity, or null before successful login or after disconnect
    • clientLanguage

      @Nullable default String clientLanguage()
      Returns the latest language from client information forwarded to the server.
      Returns:
      client language, or null before one is forwarded or after disconnect
    • state

      default ConnectionState state()
      Returns the explicit connection/player lifecycle state.
      Returns:
      current state
    • inboundPhase

      ProtocolPhase inboundPhase()
      Returns the currently observed inbound phase.
      Returns:
      inbound phase
    • outboundPhase

      ProtocolPhase outboundPhase()
      Returns the currently observed outbound phase.
      Returns:
      outbound phase
    • send

      void send(Object nativePacket)
      Writes a native clientbound packet and flushes the connection.
    • send

      default void send(Object owner, Object nativePacket, PacketSendCompletion completion)
      Writes, flushes, and reports actual transport completion for one lifecycle owner.
    • sendSilently

      void sendSilently(Object nativePacket)
      Writes and flushes while bypassing only NativePackets listeners.
    • sendSilently

      default void sendSilently(Object owner, Object nativePacket, PacketSendCompletion completion)
      Silently writes, flushes, and reports actual transport completion for one lifecycle owner.
    • write

      void write(Object nativePacket)
      Writes a native clientbound packet without forcing a flush.
    • write

      default void write(Object owner, Object nativePacket, PacketSendCompletion completion)
      Writes and reports completion after a later flush for one lifecycle owner.
    • writeSilently

      void writeSilently(Object nativePacket)
      Writes without flushing while bypassing only NativePackets listeners.
    • writeSilently

      default void writeSilently(Object owner, Object nativePacket, PacketSendCompletion completion)
      Silently writes and reports completion after a later flush for one lifecycle owner.
    • flush

      void flush()
      Flushes pending outbound writes.
    • receive

      void receive(Object nativePacket)
      Injects an already-decoded native serverbound packet through NativePackets listeners.
    • receiveSilently

      void receiveSilently(Object nativePacket)
      Injects an already-decoded native serverbound packet after NativePackets listeners.
    • isOpen

      boolean isOpen()
      Reports whether the native connection remains open.
      Returns:
      whether the connection is open
    • eventLoop

      EventLoopHandle eventLoop()
      Returns this connection's serialized event loop.
      Returns:
      event-loop handle