mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
Add reason for disconnect (#54)
* Add reason for disconnect Handles messages like "The server is full!" and "Banned by an operator." Ban reasons are shown like "You are banned from this server.\nReason: foo" * keep the kick reason as a Component in the error Co-authored-by: mat <github@matdoes.dev>
This commit is contained in:
parent
0bca3d8f5d
commit
0c30138d26
1 changed files with 4 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
pub use crate::chat::ChatPacket;
|
||||
use crate::{movement::WalkDirection, plugins::PluginStates, Account, PlayerInfo};
|
||||
use azalea_auth::{game_profile::GameProfile, sessionserver::SessionServerError};
|
||||
use azalea_chat::Component;
|
||||
use azalea_core::{ChunkPos, ResourceLocation, Vec3};
|
||||
use azalea_protocol::{
|
||||
connect::{Connection, ConnectionError, ReadConnection, WriteConnection},
|
||||
|
@ -145,6 +146,8 @@ pub enum JoinError {
|
|||
InvalidAddress,
|
||||
#[error("Couldn't refresh access token: {0}")]
|
||||
Auth(#[from] azalea_auth::AuthError),
|
||||
#[error("Disconnected: {reason}")]
|
||||
Disconnect { reason: Component },
|
||||
}
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
|
@ -346,6 +349,7 @@ impl Client {
|
|||
}
|
||||
ClientboundLoginPacket::LoginDisconnect(p) => {
|
||||
debug!("Got disconnect {:?}", p);
|
||||
return Err(JoinError::Disconnect { reason: p.reason });
|
||||
}
|
||||
ClientboundLoginPacket::CustomQuery(p) => {
|
||||
debug!("Got custom query {:?}", p);
|
||||
|
|
Loading…
Add table
Reference in a new issue