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.Returns this connection's serialized event loop.voidflush()Flushes pending outbound writes.longid()Returns the sanitized connection identifier.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.voidsendSilently(Object nativePacket) Writes and flushes while bypassing only NativePackets listeners.voidWrites a native clientbound packet without forcing a flush.voidwriteSilently(Object nativePacket) Writes without flushing while bypassing only NativePackets listeners.
-
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
-
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. -
sendSilently
Writes and flushes while bypassing only NativePackets listeners. -
write
Writes a native clientbound packet without forcing a flush. -
writeSilently
Writes without flushing while bypassing only NativePackets listeners. -
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
-