Package net.minecraft.network.listener
Interface PacketListener
- All Known Subinterfaces:
ClientLoginPacketListener,ClientPlayPacketListener,ClientQueryPacketListener,ServerHandshakePacketListener,ServerLoginPacketListener,ServerPlayPacketListener,ServerQueryPacketListener
- All Known Implementing Classes:
ClientLoginNetworkHandler,ClientPlayNetworkHandler,LocalServerHandshakeNetworkHandler,ServerHandshakeNetworkHandler,ServerLoginNetworkHandler,ServerPlayNetworkHandler,ServerQueryNetworkHandler
public interface PacketListener
A packet listener listens to packets on a connection.
Its listener methods will be called on the netty event loop than the client or server game engine threads.
-
Method Summary
Modifier and Type Method Description ClientConnectiongetConnection()Returns the connection this packet listener intends to listen to.voidonDisconnected(Text reason)Called when the connection this listener listens to has disconnected.
-
Method Details
-
onDisconnected
Called when the connection this listener listens to has disconnected. Can be used to display the disconnection reason.- Parameters:
reason- the reason of disconnection; may be a generic message
-
getConnection
ClientConnection getConnection()Returns the connection this packet listener intends to listen to.- See Also:
ClientConnection.getPacketListener()
-