1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

don't panic on kick

This commit is contained in:
mat 2022-11-07 22:06:02 -06:00
parent 7844a05650
commit 21898627fd
2 changed files with 19 additions and 11 deletions

View file

@ -31,7 +31,7 @@ use azalea_world::{
entity::{metadata, EntityData, EntityMetadata, EntityMut, EntityRef},
Dimension,
};
use log::{debug, error, warn};
use log::{debug, error, info, warn};
use parking_lot::{Mutex, RwLock};
use std::{
fmt::Debug,
@ -309,6 +309,11 @@ impl Client {
}
},
Err(e) => {
if let ReadPacketError::ConnectionClosed = e {
info!("Connection closed");
client.shutdown().await;
return;
}
if IGNORE_ERRORS {
warn!("{}", e);
match e {

View file

@ -8,17 +8,20 @@ struct State {}
async fn main() -> anyhow::Result<()> {
env_logger::init();
let account = Account::microsoft("example@example.com").await?;
// let account = Account::microsoft("example@example.com").await?;
let account = Account::offline("bot");
azalea::start(azalea::Options {
account,
address: "localhost",
state: State::default(),
plugins: vec![],
handle,
})
.await
.unwrap();
loop {
let e = azalea::start(azalea::Options {
account: account.clone(),
address: "localhost",
state: State::default(),
plugins: vec![],
handle,
})
.await;
println!("{:?}", e);
}
Ok(())
}