aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/plugins/connection.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-09-20 20:35:16 -1200
committermat <git@matdoes.dev>2025-09-20 20:35:16 -1200
commit585b51e91a5335eae37bc5af7c0111bb2092b156 (patch)
treec1559014df9db20dd625d9fe972d4e9f88317008 /azalea-client/src/plugins/connection.rs
parentdb793448ff8e656ad80859835edc3b89cb547dd2 (diff)
downloadazalea-drasl-585b51e91a5335eae37bc5af7c0111bb2092b156.tar.xz
more accurate mining and impl PartialEq for packets
Diffstat (limited to 'azalea-client/src/plugins/connection.rs')
-rw-r--r--azalea-client/src/plugins/connection.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/azalea-client/src/plugins/connection.rs b/azalea-client/src/plugins/connection.rs
index a929a4c7..f439ac33 100644
--- a/azalea-client/src/plugins/connection.rs
+++ b/azalea-client/src/plugins/connection.rs
@@ -1,4 +1,12 @@
-use std::{fmt::Debug, io::Cursor, mem, sync::Arc};
+use std::{
+ fmt::Debug,
+ io::Cursor,
+ mem,
+ sync::{
+ Arc,
+ atomic::{self, AtomicBool},
+ },
+};
use azalea_crypto::Aes128CfbEnc;
use azalea_protocol::{
@@ -232,9 +240,12 @@ impl RawConnection {
if let Some(network) = &mut self.network {
network.write(packet)?;
} else {
- debug!(
- "tried to write packet to the network but there is no NetworkConnection. if you're trying to send a packet from the handler function, use self.write instead"
- );
+ static WARNED: AtomicBool = AtomicBool::new(false);
+ if !WARNED.swap(true, atomic::Ordering::Relaxed) {
+ debug!(
+ "tried to write packet to the network but there is no NetworkConnection. if you're trying to send a packet from the handler function, use self.write instead"
+ );
+ }
}
Ok(())
}