From 7ab3b8924f64f7eadb6b8928b6fae73cb06e4c2f Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 28 Dec 2025 14:31:41 +0500 Subject: move Event and auto_reconnect to the azalea crate --- azalea/src/swarm/builder.rs | 7 ++----- azalea/src/swarm/mod.rs | 10 +++++----- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'azalea/src/swarm') diff --git a/azalea/src/swarm/builder.rs b/azalea/src/swarm/builder.rs index 4eae7eab..860e47be 100644 --- a/azalea/src/swarm/builder.rs +++ b/azalea/src/swarm/builder.rs @@ -8,11 +8,7 @@ use std::{ time::Duration, }; -use azalea_client::{ - Account, DefaultPlugins, - auto_reconnect::{AutoReconnectDelay, DEFAULT_RECONNECT_DELAY}, - start_ecs_runner, -}; +use azalea_client::{Account, DefaultPlugins, start_ecs_runner}; use azalea_protocol::address::{ResolvableAddr, ResolvedAddr}; use azalea_world::InstanceContainer; use bevy_app::{App, AppExit, Plugins, SubApp}; @@ -24,6 +20,7 @@ use tracing::{debug, error, warn}; use crate::{ BoxHandleFn, HandleFn, JoinOpts, NoState, + auto_reconnect::{AutoReconnectDelay, DEFAULT_RECONNECT_DELAY}, bot::DefaultBotPlugins, swarm::{ BoxSwarmHandleFn, DefaultSwarmPlugins, NoSwarmState, Swarm, SwarmEvent, SwarmHandleFn, diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index c0f9cbca..48ac20a3 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -12,7 +12,7 @@ use std::sync::{ atomic::{self, AtomicBool}, }; -use azalea_client::{Account, Event, chat::ChatPacket, join::ConnectOpts}; +use azalea_client::{Account, chat::ChatPacket, join::ConnectOpts}; use azalea_entity::LocalEntity; use azalea_protocol::address::ResolvedAddr; use azalea_world::InstanceContainer; @@ -45,7 +45,7 @@ pub struct Swarm { pub instance_container: Arc>, /// This is used internally to make the client handler function work. - pub(crate) bots_tx: mpsc::UnboundedSender<(Option, Client)>, + pub(crate) bots_tx: mpsc::UnboundedSender<(Option, Client)>, /// This is used internally to make the swarm handler function work. pub(crate) swarm_tx: mpsc::UnboundedSender, } @@ -207,9 +207,9 @@ impl Swarm { /// Copy the events from a client's receiver into bots_tx, until the bot is /// removed from the ECS. async fn event_copying_task( - mut rx: mpsc::UnboundedReceiver, + mut rx: mpsc::UnboundedReceiver, swarm_tx: mpsc::UnboundedSender, - bots_tx: mpsc::UnboundedSender<(Option, Client)>, + bots_tx: mpsc::UnboundedSender<(Option, Client)>, bot: Client, join_opts: JoinOpts, ) { @@ -246,7 +246,7 @@ impl Swarm { } } - if let Event::Disconnect(_) = event { + if let crate::Event::Disconnect(_) = event { debug!( "Sending SwarmEvent::Disconnect due to receiving an Event::Disconnect from client {}", bot.entity -- cgit v1.2.3