diff options
| author | mat <git@matdoes.dev> | 2025-09-28 13:10:04 -0545 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-09-28 13:10:04 -0545 |
| commit | 2c8b7c5c2c9297273abfba8f7743f1bc25f166b1 (patch) | |
| tree | 3d3aded400100c136287fa59293ce26c61644d00 /azalea-client/src/plugins/chat | |
| parent | e2ed19c1ed92f0dccc881d835d9ac6e0f7f834c0 (diff) | |
| download | azalea-drasl-2c8b7c5c2c9297273abfba8f7743f1bc25f166b1.tar.xz | |
upgrade bevy to 0.17.0-rc.2
Diffstat (limited to 'azalea-client/src/plugins/chat')
| -rw-r--r-- | azalea-client/src/plugins/chat/handler.rs | 4 | ||||
| -rw-r--r-- | azalea-client/src/plugins/chat/mod.rs | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/azalea-client/src/plugins/chat/handler.rs b/azalea-client/src/plugins/chat/handler.rs index a289eb14..d71bcbd1 100644 --- a/azalea-client/src/plugins/chat/handler.rs +++ b/azalea-client/src/plugins/chat/handler.rs @@ -21,7 +21,7 @@ use crate::{Account, chat_signing::ChatSigningSession, packet::game::SendPacketE /// preserved if multiple chat messages and commands are sent at the same time. /// /// [`SendChatEvent`]: super::SendChatEvent -#[derive(Event)] +#[derive(Message)] pub struct SendChatKindEvent { pub entity: Entity, pub content: String, @@ -29,7 +29,7 @@ pub struct SendChatKindEvent { } pub fn handle_send_chat_kind_event( - mut events: EventReader<SendChatKindEvent>, + mut events: MessageReader<SendChatKindEvent>, mut commands: Commands, mut query: Query<(&Account, &mut ChatSigningSession)>, ) { diff --git a/azalea-client/src/plugins/chat/mod.rs b/azalea-client/src/plugins/chat/mod.rs index f8ef3251..098b6543 100644 --- a/azalea-client/src/plugins/chat/mod.rs +++ b/azalea-client/src/plugins/chat/mod.rs @@ -19,9 +19,9 @@ use crate::client::Client; pub struct ChatPlugin; impl Plugin for ChatPlugin { fn build(&self, app: &mut App) { - app.add_event::<SendChatEvent>() - .add_event::<SendChatKindEvent>() - .add_event::<ChatReceivedEvent>() + app.add_message::<SendChatEvent>() + .add_message::<SendChatKindEvent>() + .add_message::<ChatReceivedEvent>() .add_systems( Update, (handle_send_chat_event, handle_send_chat_kind_event).chain(), @@ -189,7 +189,7 @@ impl Client { /// 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().send_event(SendChatKindEvent { + self.ecs.lock().write_message(SendChatKindEvent { entity: self.entity, content: message.to_string(), kind: ChatKind::Message, @@ -202,7 +202,7 @@ impl Client { /// 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().send_event(SendChatKindEvent { + self.ecs.lock().write_message(SendChatKindEvent { entity: self.entity, content: command.to_string(), kind: ChatKind::Command, @@ -219,7 +219,7 @@ impl Client { /// # } /// ``` pub fn chat(&self, content: impl Into<String>) { - self.ecs.lock().send_event(SendChatEvent { + self.ecs.lock().write_message(SendChatEvent { entity: self.entity, content: content.into(), }); @@ -227,22 +227,22 @@ impl Client { } /// A client received a chat message packet. -#[derive(Event, Debug, Clone)] +#[derive(Message, Debug, Clone)] pub struct ChatReceivedEvent { pub entity: Entity, pub packet: ChatPacket, } /// Send a chat message (or command, if it starts with a slash) to the server. -#[derive(Event)] +#[derive(Message)] pub struct SendChatEvent { pub entity: Entity, pub content: String, } pub fn handle_send_chat_event( - mut events: EventReader<SendChatEvent>, - mut send_chat_kind_events: EventWriter<SendChatKindEvent>, + mut events: MessageReader<SendChatEvent>, + mut send_chat_kind_events: MessageWriter<SendChatKindEvent>, ) { for event in events.read() { if event.content.starts_with('/') { |
