Interface ICommonPacketListener
- All Superinterfaces:
PacketListener
- All Known Subinterfaces:
ClientCommonPacketListener,ClientConfigurationPacketListener,ClientGamePacketListener,IClientCommonPacketListenerExtension,IServerCommonPacketListenerExtension,IServerConfigurationPacketListenerExtension,IServerGamePacketListenerExtension,ServerCommonPacketListener,ServerConfigurationPacketListener,ServerGamePacketListener
- All Known Implementing Classes:
ClientCommonPacketListenerImpl,ClientConfigurationPacketListenerImpl,ClientPacketListener,FakePlayer.FakePlayerNetHandler,ServerCommonPacketListenerImpl,ServerConfigurationPacketListenerImpl,ServerGamePacketListenerImpl
Extension interface and functionality hoist for both
ServerCommonPacketListener
and ClientCommonPacketListener.-
Method Summary
Modifier and TypeMethodDescriptionvoiddisconnect(Component reason) Triggers a disconnection with the given reason.Returns the connection this listener is attached to.Returns the connection type of this packet listener.Returns the main thread event loop.default booleanhasChannel(CustomPacketPayload payload) default booleanhasChannel(CustomPacketPayload.Type<?> type) default booleanhasChannel(ResourceLocation payloadId) Checks if the connection has negotiated and opened a channel for the payload.voidsend(CustomPacketPayload payload) Sends a payload to the target of this listener.voidSends a packet to the target of this listener.Methods inherited from interface net.minecraft.network.PacketListener
createDisconnectionInfo, fillCrashReport, fillListenerSpecificCrashDetails, flow, isAcceptingMessages, onDisconnect, onPacketError, protocol, shouldHandleMessage
-
Method Details
-
send
Sends a packet to the target of this listener. -
send
Sends a payload to the target of this listener. -
disconnect
Triggers a disconnection with the given reason.- Parameters:
reason- The reason for the disconnection
-
getConnection
Connection getConnection()Returns the connection this listener is attached to.- Returns:
- the connection this listener is attached to
-
getMainThreadEventLoop
ReentrantBlockableEventLoop<?> getMainThreadEventLoop()Returns the main thread event loop.- Returns:
- the main thread event loop
-
hasChannel
Checks if the connection has negotiated and opened a channel for the payload.- Parameters:
payloadId- The payload id to check
-
hasChannel
-
hasChannel
-
getConnectionType
ConnectionType getConnectionType()Returns the connection type of this packet listener.- Returns:
- the connection type of this packet listener
-