diff options
Diffstat (limited to 'minecraft-protocol/src/packets/login/serverbound_hello_packet.rs')
| -rw-r--r-- | minecraft-protocol/src/packets/login/serverbound_hello_packet.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/minecraft-protocol/src/packets/login/serverbound_hello_packet.rs b/minecraft-protocol/src/packets/login/serverbound_hello_packet.rs index 345b11f6..9415fe82 100644 --- a/minecraft-protocol/src/packets/login/serverbound_hello_packet.rs +++ b/minecraft-protocol/src/packets/login/serverbound_hello_packet.rs @@ -4,23 +4,25 @@ use tokio::io::BufReader; use crate::{mc_buf, packets::Packet}; +use super::LoginPacket; + #[derive(Hash, Clone, Debug)] pub struct ServerboundHelloPacket { pub username: String, } -#[async_trait] impl ServerboundHelloPacket { - fn get(self) -> Packet { - Packet::ServerboundHelloPacket(self) + pub fn get(self) -> LoginPacket { + LoginPacket::ServerboundHelloPacket(self) } - fn write(&self, buf: &mut Vec<u8>) { + + pub fn write(&self, buf: &mut Vec<u8>) { mc_buf::write_utf(buf, &self.username); } - async fn read<T: tokio::io::AsyncRead + std::marker::Unpin + std::marker::Send>( - _buf: &mut BufReader<T>, - ) -> Result<Packet, String> { + pub async fn read<T: tokio::io::AsyncRead + std::marker::Unpin + std::marker::Send>( + buf: &mut BufReader<T>, + ) -> Result<LoginPacket, String> { Err("ServerboundHelloPacket::read not implemented".to_string()) } } |
