diff options
| author | mat <github@matdoes.dev> | 2021-12-15 13:08:36 -0600 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2021-12-15 13:08:36 -0600 |
| commit | ace140500734d33fe53126086a8d9278fa861e21 (patch) | |
| tree | 7ed5ab284631272afd81ccc2ee2d3b774555a975 /minecraft-protocol/src/packets/login/serverbound_hello_packet.rs | |
| parent | 0d6e4179e6cc16594a4be3ecd62d89411115f319 (diff) | |
| download | azalea-drasl-ace140500734d33fe53126086a8d9278fa861e21.tar.xz | |
isolate packets
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()) } } |
