fix(protocol): banned and whitelist message not showing to players (#2936)

This commit is contained in:
Xavier horwood
2026-08-15 18:08:37 +10:00
committed by GitHub
parent c10341b80f
commit ef3f7aeb0f

View File

@@ -9,6 +9,7 @@ use pumpkin_protocol::{
java::{
client::config::CConfigDisconnect,
client::login::CLoginDisconnect,
client::play::CPlayDisconnect,
packet_decoder::TCPNetworkDecoder,
packet_encoder::TCPNetworkEncoder,
server::config::{
@@ -160,6 +161,9 @@ impl PendingConnection {
self.send_packet_now(&CConfigDisconnect::new(&reason.get_text()))
.await;
}
ConnectionState::Play => {
self.send_packet_now(&CPlayDisconnect::new(&reason)).await;
}
_ => {}
}
debug!("Closing connection for {}", self.id);
@@ -357,11 +361,11 @@ impl PendingConnection {
return Ok(Some(PacketHandlerResult::Stop));
};
let config = self.config.clone().unwrap_or_default();
self.connection_state.store(ConnectionState::Play);
if let Some(reason) = can_not_join(&profile, &self.address, server).await {
self.kick(reason).await;
Ok(Some(PacketHandlerResult::Stop))
} else {
self.connection_state.store(ConnectionState::Play);
Ok(Some(PacketHandlerResult::ReadyToPlay(profile, config)))
}
}