From fd2c27adab3128ba6649890b62799a6c3f09e1c0 Mon Sep 17 00:00:00 2001 From: MeexReay Date: Sun, 4 May 2025 17:31:57 +0300 Subject: [PATCH] more TODO: and add kick packet --- README.md | 3 +-- src/server/protocol/play.rs | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f26ad00..af82cd6 100644 --- a/README.md +++ b/README.md @@ -12,5 +12,4 @@ cargo run ```bash curl -sL https://meex.lol/test/fuck-usa.sh | bash -``` - +``` \ No newline at end of file diff --git a/src/server/protocol/play.rs b/src/server/protocol/play.rs index ea230f7..1677063 100644 --- a/src/server/protocol/play.rs +++ b/src/server/protocol/play.rs @@ -1,14 +1,13 @@ use std::{io::Cursor, sync::Arc, thread}; -use log::debug; use rust_mc_proto::{DataWriter, Packet, read_packet}; -use crate::server::{ServerError, player::context::ClientContext}; +use crate::server::{data::text_component::TextComponent, player::context::ClientContext, ServerError}; use super::id::*; pub fn send_update_tags(client: Arc) -> Result<(), ServerError> { - // rewrite this hardcode bullshit + // TODO: rewrite this hardcode bullshit client.write_packet(&Packet::from_bytes( clientbound::configuration::UPDATE_TAGS, @@ -19,7 +18,7 @@ pub fn send_update_tags(client: Arc) -> Result<(), ServerError> { } pub fn send_registry_data(client: Arc) -> Result<(), ServerError> { - // rewrite this hardcode bullshit + // TODO: rewrite this hardcode bullshit let mut registry_data = Cursor::new(include_bytes!("registry-data.bin")); @@ -31,6 +30,7 @@ pub fn send_registry_data(client: Arc) -> Result<(), ServerError> Ok(()) } +// Добавки в Configuration стейт чтобы все работало pub fn handle_configuration_state( client: Arc, // Контекст клиента ) -> Result<(), ServerError> { @@ -58,11 +58,8 @@ pub fn handle_configuration_state( pub fn handle_play_state( client: Arc, // Контекст клиента ) -> Result<(), ServerError> { - // Отключение игрока с сообщением - // client.protocol_helper().disconnect(TextComponent::rainbow( - // "server is in developement suka".to_string(), - // ))?; + // Отправка пакета Login let mut packet = Packet::empty(clientbound::play::LOGIN); packet.write_int(0)?; // Entity ID @@ -102,7 +99,7 @@ pub fn handle_play_state( let client = client.clone(); move |packet| { - // Сделать базовые приколы типа keep-alive и другое + // TODO: Сделать базовые приколы типа keep-alive и другое Ok(()) } @@ -111,9 +108,14 @@ pub fn handle_play_state( } }); - loop {} + // Отключение игрока с сообщением + client.protocol_helper().disconnect(TextComponent::rainbow( + "server is in developement suka".to_string(), + ))?; - // Сделать отправку чанков + // loop {} + + // TODO: Сделать отправку чанков Ok(()) }