Package devs.beer.nativepackets.api
Interface NativePacketsApi
public interface NativePacketsApi
Entry point exposed to NativePackets consumers.
-
Method Summary
Modifier and TypeMethodDescriptionconnection(Object platformPlayer) Returns the active connection for a platform player.fast()Returns allocation-minimal semantic packet sends addressed to platform players.Returns the public packet listener registry.packets()Returns the exact-version packet factory.platform()Returns the detected runtime platform.default Set<PacketType<?>> Returns the immutable, stable set of typed packets registered by the active adapter.default booleansupports(PacketType<?> type) Reports whether the active adapter provides a typed view for this canonical packet type.Returns the exact-adapter native text factory.Returns exact-adapter platform utilities.version()Returns the NativePackets implementation version.
-
Method Details
-
version
String version()Returns the NativePackets implementation version.- Returns:
- implementation version
-
platform
PlatformInfo platform()Returns the detected runtime platform.- Returns:
- runtime platform
-
listeners
PacketListenerRegistry listeners()Returns the public packet listener registry.- Returns:
- listener registry
-
supportedPacketTypes
Returns the immutable, stable set of typed packets registered by the active adapter.Unlike
PacketTypes.values(), this describes the exact server runtime. It includes explicitly registered semantic aliases. It does not guarantee support for every view field, packet factory overload, or negotiated client protocol. No view or native packet is created by this query.- Returns:
- exact-runtime typed packet capabilities, with no iteration order guarantee
- Throws:
IllegalStateException- when the runtime is not enabledUnsupportedOperationException- when an older implementation lacks discovery
-
supports
Reports whether the active adapter provides a typed view for this canonical packet type.Use during listener setup instead of comparing Minecraft version strings. A separately created type with the same key or index is not the canonical type.
- Parameters:
type- non-null semantic packet type- Returns:
- whether the type belongs to
supportedPacketTypes() - Throws:
IllegalStateException- when the runtime is not enabledUnsupportedOperationException- when an older implementation lacks discovery
-
connection
Returns the active connection for a platform player.- Parameters:
platformPlayer- platform player owned by this server- Returns:
- cached connection handle
- Throws:
IllegalStateException- when the player connection is not injected
-
fast
FastPacketSender fast()Returns allocation-minimal semantic packet sends addressed to platform players.- Returns:
- stable fast packet sender
-
packets
NativePacketFactory packets()Returns the exact-version packet factory.The factory creates native packets for the active server version. Its returned packet objects are version-coupled and must only be sent through this runtime's
ConnectionHandle.- Returns:
- exact-adapter packet factory
-
utilities
PlatformUtilities utilities()Returns exact-adapter platform utilities.- Returns:
- platform utilities
-
textFactory
NativeTextFactory textFactory()Returns the exact-adapter native text factory.- Returns:
- native text factory
-