Skip to main content

steel_protocol/packets/login/
c_login_disconnect.rs

1use steel_macros::{ClientPacket, WriteTo};
2use steel_registry::packets::login::C_LOGIN_DISCONNECT;
3use text_components::{TextComponent, resolving::TextResolutor};
4
5#[derive(ClientPacket, WriteTo, Clone, Debug)]
6#[packet_id(Login = C_LOGIN_DISCONNECT)]
7pub struct CLoginDisconnect {
8    #[write(as = Json)]
9    pub reason: TextComponent,
10}
11
12impl CLoginDisconnect {
13    #[must_use]
14    pub fn new<T: TextResolutor>(reason: &TextComponent, resolutor: &T) -> Self {
15        Self {
16            reason: reason.resolve(resolutor),
17        }
18    }
19}