diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-02-25 17:32:15 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-25 17:32:15 -0600 |
| commit | c1588ef66e844c067112ea880a54b4de9ec5a062 (patch) | |
| tree | 76e4f73a5f5392e1bef1f0560ed2f2c56b0d50fb /azalea-client/examples | |
| parent | f5a8a59467a0aac3ae2f728961559217f1e1242d (diff) | |
| download | azalea-drasl-c1588ef66e844c067112ea880a54b4de9ec5a062.tar.xz | |
Fix system order ambiguities (#74)
* start fixing stuff where systems run in the wrong order
* fix ordering ambiguity
* add debugging guide
* some fixes
* fix panic for swarms
* fix some warnings
Diffstat (limited to 'azalea-client/examples')
| -rw-r--r-- | azalea-client/examples/echo.rs | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/azalea-client/examples/echo.rs b/azalea-client/examples/echo.rs deleted file mode 100644 index f37cd904..00000000 --- a/azalea-client/examples/echo.rs +++ /dev/null @@ -1,49 +0,0 @@ -//! A simple bot that repeats chat messages sent by other players. - -use azalea_client::{Account, Client, Event}; - -#[tokio::main] -async fn main() { - env_logger::init(); - // deadlock detection, you can safely delete this block if you're not trying to - // debug deadlocks in azalea - { - use parking_lot::deadlock; - use std::thread; - use std::time::Duration; - thread::spawn(move || loop { - thread::sleep(Duration::from_secs(10)); - let deadlocks = deadlock::check_deadlock(); - if deadlocks.is_empty() { - continue; - } - println!("{} deadlocks detected", deadlocks.len()); - for (i, threads) in deadlocks.iter().enumerate() { - println!("Deadlock #{i}"); - for t in threads { - println!("Thread Id {:#?}", t.thread_id()); - println!("{:#?}", t.backtrace()); - } - } - }); - } - - let account = Account::offline("bot"); - // or let account = Account::microsoft("email").await; - - let (client, mut rx) = Client::join(&account, "localhost").await.unwrap(); - - while let Some(event) = rx.recv().await { - match &event { - Event::Chat(m) => { - if let (Some(sender), content) = m.split_sender_and_content() { - if sender == client.profile.name { - continue; // ignore our own messages - } - client.chat(&content); - }; - } - _ => {} - } - } -} |
