Adding a Login Disconnect listener stops disconnect packets sending
jok-dev opened this issue ยท 0 comments
- This issue is not solved in a development build
Describe the bug
Adding a Login Disconnect listener stops disconnect packets sending to the client when players are disallowed during the AsyncPlayerPreLoginEvent.
To Reproduce
Add a plugin that has the following code. Note that nothing is required in the packet-sending body at all.
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(plugin,
ListenerPriority.NORMAL, PacketType.Login.Server.DISCONNECT) {
@Override
public void onPacketSending(PacketEvent event) {
}
});
@EventHandler
public void onAsyncPlayerPreLogin(AsyncPlayerPreLoginEvent event) {
event.disallow(Result.KICK_BANNED, "Kick message");
}
Expected behavior
The packet listener should be called (which it never is), and then the packet should be sent to the player before they disconnect, and the kick message should be displayed to the player.
Screenshots
Even if a kick message is provided, the client only knows that the connection was closed, it never receives a disconnect packet with a reason.
Version Info
ProtocolLib v5.0.0-SNAPSHOT-b606
Bukkit Version: 1.19.2-R0.1-SNAPSHOT
com.test.plugin.Debug$1@93135cd[
plugin=Debug v1.0
connectionSide=SERVER_SIDE
receivingWhitelist=EMPTY_WHITELIST
sendingWhitelist=ListeningWhitelist[priority=NORMAL, packets=[DISCONNECT[class=PacketLoginOutDisconnect, id=0]], gamephase=PLAYING, options=[]]
]
Additional context
When connections disconnect, Paper calls "clearPacketQueue" before the connection is closed, is it possible ProtocolLib stops the packet being added to this queue, and therefore the packet is not sent before the disconnection?