diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-12-27 22:02:00 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-27 22:02:00 -0600 |
| commit | 9513f42e87f64c409cdb2a100500a50e5a713bac (patch) | |
| tree | bb6aa8b6d50fddf967bcb1f759e023754ea84e49 /azalea-client/src/plugins/chat/mod.rs | |
| parent | 588902ba4a3965982bdd84d92b20c6f7613f3978 (diff) | |
| download | azalea-drasl-9513f42e87f64c409cdb2a100500a50e5a713bac.tar.xz | |
Move Client struct to azalea crate (#297)
* move the Client struct out of azalea-client into azalea
* actually add client impls in azalea
Diffstat (limited to 'azalea-client/src/plugins/chat/mod.rs')
| -rw-r--r-- | azalea-client/src/plugins/chat/mod.rs | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/azalea-client/src/plugins/chat/mod.rs b/azalea-client/src/plugins/chat/mod.rs index bd90a8d6..11ad742c 100644 --- a/azalea-client/src/plugins/chat/mod.rs +++ b/azalea-client/src/plugins/chat/mod.rs @@ -14,8 +14,6 @@ use bevy_ecs::prelude::*; use handler::{SendChatKindEvent, handle_send_chat_kind_event}; use uuid::Uuid; -use crate::client::Client; - pub struct ChatPlugin; impl Plugin for ChatPlugin { fn build(&self, app: &mut App) { @@ -187,52 +185,6 @@ impl ChatPacket { } } -impl Client { - /// Send a chat message to the server. - /// - /// This only sends the chat packet and not the command packet, which means - /// on some servers you can use this to send chat messages that start - /// with a `/`. The [`Client::chat`] function handles checking whether - /// the message is a command and using the proper packet for you, so you - /// should use that instead. - pub fn write_chat_packet(&self, message: &str) { - self.ecs.lock().write_message(SendChatKindEvent { - entity: self.entity, - content: message.to_owned(), - kind: ChatKind::Message, - }); - } - - /// Send a command packet to the server. The `command` argument should not - /// include the slash at the front. - /// - /// You can also just use [`Client::chat`] and start your message with a `/` - /// to send a command. - pub fn write_command_packet(&self, command: &str) { - self.ecs.lock().write_message(SendChatKindEvent { - entity: self.entity, - content: command.to_owned(), - kind: ChatKind::Command, - }); - } - - /// Send a message in chat. - /// - /// ```rust,no_run - /// # use azalea_client::Client; - /// # async fn example(bot: Client) -> anyhow::Result<()> { - /// bot.chat("Hello, world!"); - /// # Ok(()) - /// # } - /// ``` - pub fn chat(&self, content: impl Into<String>) { - self.ecs.lock().write_message(SendChatEvent { - entity: self.entity, - content: content.into(), - }); - } -} - /// A client received a chat message packet. #[derive(Clone, Debug, Message)] pub struct ChatReceivedEvent { |
