Pumpkin/pumpkin-protocol/src/server/login/s_login_start.rs
2024-12-21 17:05:44 +01:00

23 lines
474 B
Rust

use bytes::Buf;
use pumpkin_macros::server_packet;
use crate::{
bytebuf::{ByteBuf, ReadingError},
ServerPacket,
};
#[server_packet("login:hello")]
pub struct SLoginStart {
pub name: String, // 16
pub uuid: uuid::Uuid,
}
impl ServerPacket for SLoginStart {
fn read(bytebuf: &mut impl Buf) -> Result<Self, ReadingError> {
Ok(Self {
name: bytebuf.try_get_string_len(16)?,
uuid: bytebuf.try_get_uuid()?,
})
}
}