-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0.3.1 - AutoExit & AutoReconnect Plugins
- Loading branch information
Showing
7 changed files
with
74 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use azalea::{ | ||
app::{App, Plugin, Update}, | ||
disconnect::DisconnectEvent, | ||
ecs::prelude::*, | ||
}; | ||
|
||
pub struct AutoExitPlugin; | ||
|
||
impl Plugin for AutoExitPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.add_systems(Update, handle_disconnect_event); | ||
} | ||
} | ||
|
||
pub fn handle_disconnect_event(mut events: EventReader<DisconnectEvent>) { | ||
for event in events.read() { | ||
let Some(reason) = &event.reason else { | ||
continue; | ||
}; | ||
|
||
println!("Disconnect Reason: {}", reason.to_ansi()); | ||
if ["AutoDisconnect"].contains(&&*reason.to_string()) { | ||
eprintln!("Exiting to stay disconnected..."); | ||
std::process::exit(1); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
pub use super::{ | ||
anti_afk::*, | ||
auto_eat::*, | ||
auto_exit::*, | ||
auto_look::*, | ||
auto_pearl::*, | ||
auto_totem::*, | ||
|