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 | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/minecraft-protocol/src/packets/login/serverbound_hello_packet.rs b/minecraft-protocol/src/packets/login/serverbound_hello_packet.rs new file mode 100644 index 00000000..cadf9f7b --- /dev/null +++ b/minecraft-protocol/src/packets/login/serverbound_hello_packet.rs @@ -0,0 +1,29 @@ +use async_trait::async_trait; +use std::hash::Hash; +use tokio::io::BufReader; + +use crate::{ + mc_buf, + packets::{Packet, PacketTrait}, +}; + +#[derive(Hash, Clone, Debug)] +pub struct ServerboundHelloPacket { + pub username: String, +} + +#[async_trait] +impl PacketTrait for ServerboundHelloPacket { + fn get(self) -> Packet { + Packet::ServerboundHelloPacket(self) + } + 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> { + Err("ServerboundHelloPacket::read not implemented".to_string()) + } +} |
