feat: add login_start packet parsing for username extraction

This commit is contained in:
Tamipes 2026-01-19 16:26:05 +01:00
parent c697449b20
commit d531ba59a0
4 changed files with 55 additions and 5 deletions

View file

@ -42,14 +42,12 @@ pub async fn complete_status_request(
/// Disconnects the client.
///
/// It works if the client is in the login state, and it
/// has *already* and *only* sent the handshake packet.
/// has *already* and *only* sent the **handshake** and **login_start** packet.
#[tracing::instrument(skip(client_stream))]
pub async fn send_disconnect(
client_stream: &mut TcpStream,
reason: &str,
) -> Result<(), OpaqueError> {
let _client_packet = Packet::parse(client_stream).await?;
let disconnect_packet =
crate::packets::clientbound::login::Disconnect::set_reason(reason.to_owned())
.await