diff options
| author | mat <git@matdoes.dev> | 2025-11-12 04:26:02 +0330 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-11-11 18:56:14 -0600 |
| commit | a4312599f7c04709a92b7be238dcf577bafbb14f (patch) | |
| tree | bef58dca34239bac54649ab1e0db2597de10212c /azalea/src | |
| parent | ac2b425615dd6cd8562c290e33b06e553559802d (diff) | |
| download | azalea-drasl-a4312599f7c04709a92b7be238dcf577bafbb14f.tar.xz | |
cleanup
- remove deprecated code
- add `[lints] workspace=true` to every Cargo.toml, to make modifying clippy lints easier for later
- remove some unnecessary #[allow]s
- use Vec3i in some parts of the collision code
Diffstat (limited to 'azalea/src')
| -rw-r--r-- | azalea/src/swarm/mod.rs | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index 59bad419..34247453 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -32,7 +32,7 @@ use bevy_app::{App, AppExit, PluginGroup, PluginGroupBuilder, Plugins, SubApp}; use bevy_ecs::prelude::*; use futures::future::{BoxFuture, join_all}; use parking_lot::{Mutex, RwLock}; -use tokio::{sync::mpsc, time::sleep}; +use tokio::sync::mpsc; use tracing::{debug, error, warn}; use crate::{BoxHandleFn, DefaultBotPlugins, HandleFn, JoinOpts, NoState, StartError}; @@ -845,52 +845,6 @@ impl Swarm { ); } - /// Add a new account to the swarm, retrying if it couldn't join. - /// - /// This will run forever until the bot joins or the task is aborted. - /// - /// This does exponential backoff (though very limited), starting at 5 - /// seconds and doubling up to 15 seconds. - #[deprecated(note = "azalea has auto-reconnect functionality built-in now, use `add` instead")] - pub async fn add_and_retry_forever<S: Component + Clone>( - &self, - account: &Account, - state: S, - ) -> Client { - #[allow(deprecated)] - self.add_and_retry_forever_with_opts(account, state, &JoinOpts::default()) - .await - } - - /// Same as [`Self::add_and_retry_forever`], but allow passing custom join - /// options. - #[deprecated( - note = "azalea has auto-reconnect functionality built-in now, use `add_with_opts` instead" - )] - pub async fn add_and_retry_forever_with_opts<S: Component + Clone>( - &self, - account: &Account, - state: S, - opts: &JoinOpts, - ) -> Client { - let mut disconnects: u32 = 0; - loop { - match self.add_with_opts(account, state.clone(), opts).await { - Ok(bot) => return bot, - Err(e) => { - disconnects += 1; - let delay = (Duration::from_secs(5) * 2u32.pow(disconnects.min(16))) - .min(Duration::from_secs(15)); - let username = account.username.clone(); - - error!("Error joining as {username}: {e}. Waiting {delay:?} and trying again."); - - sleep(delay).await; - } - } - } - } - /// Get an array of ECS [`Entity`]s for all [`LocalEntity`]s in our world. /// This will include clients that were disconnected without being removed /// from the ECS. |
