Package devs.beer.nativepackets.api
Interface ConnectionHandle
public interface ConnectionHandle
Stable handle for one native connection.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the exact runtime adapter identifier.default StringReturns the latest language from client information forwarded to the server.Returns this connection's serialized event loop.voidflush()Flushes pending outbound writes.longid()Returns the sanitized connection identifier.default ConnectionIdentityidentity()Returns the authenticated identity scoped to this physical connection.Returns the currently observed inbound phase.booleanisOpen()Reports whether the native connection remains open.Returns the currently observed outbound phase.voidInjects an already-decoded native serverbound packet through NativePackets listeners.voidreceiveSilently(Object nativePacket) Injects an already-decoded native serverbound packet after NativePackets listeners.voidWrites a native clientbound packet and flushes the connection.default voidsend(Object owner, Object nativePacket, PacketSendCompletion completion) Writes, flushes, and reports actual transport completion for one lifecycle owner.voidsendSilently(Object nativePacket) Writes and flushes while bypassing only NativePackets listeners.default voidsendSilently(Object owner, Object nativePacket, PacketSendCompletion completion) Silently writes, flushes, and reports actual transport completion for one lifecycle owner.default ConnectionStatestate()Returns the explicit connection/player lifecycle state.voidWrites a native clientbound packet without forcing a flush.default voidwrite(Object owner, Object nativePacket, PacketSendCompletion completion) Writes and reports completion after a later flush for one lifecycle owner.voidwriteSilently(Object nativePacket) Writes without flushing while bypassing only NativePackets listeners.default voidwriteSilently(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
Returns the authenticated identity scoped to this physical connection.- Returns:
- identity, or
nullbefore successful login or after disconnect
-
clientLanguage
Returns the latest language from client information forwarded to the server.- Returns:
- client language, or
nullbefore one is forwarded or after disconnect
-
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
Writes a native clientbound packet and flushes the connection. -
send
Writes, flushes, and reports actual transport completion for one lifecycle owner. -
sendSilently
Writes and flushes while bypassing only NativePackets listeners. -
sendSilently
Silently writes, flushes, and reports actual transport completion for one lifecycle owner. -
write
Writes a native clientbound packet without forcing a flush. -
write
Writes and reports completion after a later flush for one lifecycle owner. -
writeSilently
Writes without flushing while bypassing only NativePackets listeners. -
writeSilently
Silently writes and reports completion after a later flush for one lifecycle owner. -
flush
void flush()Flushes pending outbound writes. -
receive
Injects an already-decoded native serverbound packet through NativePackets listeners. -
receiveSilently
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
-