From 585b51e91a5335eae37bc5af7c0111bb2092b156 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 20 Sep 2025 20:35:16 -1200 Subject: more accurate mining and impl PartialEq for packets --- azalea-client/src/plugins/connection.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'azalea-client/src/plugins/connection.rs') 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(()) } -- cgit v1.2.3