From 8d73f281d27b0c9c329f64e75a01496185f1870f Mon Sep 17 00:00:00 2001
From: core <core@coredoes.dev>
Date: Sat, 22 Jul 2023 00:07:36 -0400
Subject: [PATCH] fix the chatspam problem again again

---
 azalea-worker/src/main.rs | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/azalea-worker/src/main.rs b/azalea-worker/src/main.rs
index 5075835..3b26fe2 100644
--- a/azalea-worker/src/main.rs
+++ b/azalea-worker/src/main.rs
@@ -281,18 +281,20 @@ async fn handle_packet(e: Event, config: &Config, client: &mut Client, ws_stream
             if !pkt.content().starts_with("/skill") {
                 info!("<{} ({})> {}", pkt.username().unwrap_or("SYSTEM".to_string()), pkt.uuid().map(|u| u.to_string()).unwrap_or("SYSTEM".to_string()), pkt.message());
                 handle_message(pkt.clone(), client, config).await;
+
+                let re = Regex::new(r"@[a-z0-9_-]+:").unwrap();
+                if !(re.is_match(&pkt.content()) && pkt.uuid() == Some(config.server.uuid)) {
+                    info!("sending message");
+                    ws_stream.send(Message::Text(serde_json::to_string(&GatewayPacketC2S::Relay { msg: GatewayChatMessage {
+                        source: GatewayChatSource::Minecraft,
+                        username: pkt.username().unwrap_or("SYSTEM".to_string()),
+                        message: pkt.content(),
+                        timestamp: DateTime::from(SystemTime::now()),
+                    }})?)).await?;
+                }
             }
 
-            let re = Regex::new(r"@[a-z0-9_-]+:").unwrap();
-            if !(re.is_match(&pkt.content()) && pkt.uuid() == Some(config.server.uuid)) {
-                info!("sending message");
-                ws_stream.send(Message::Text(serde_json::to_string(&GatewayPacketC2S::Relay { msg: GatewayChatMessage {
-                    source: GatewayChatSource::Minecraft,
-                    username: pkt.username().unwrap_or("SYSTEM".to_string()),
-                    message: pkt.content(),
-                    timestamp: DateTime::from(SystemTime::now()),
-                }})?)).await?;
-            }
+