aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src
diff options
context:
space:
mode:
authorEightFactorial <murphkev000@gmail.com>2023-01-21 20:14:23 -0800
committerGitHub <noreply@github.com>2023-01-21 22:14:23 -0600
commit9ee5e71bb13e596248fde000d8717c86276b0ce1 (patch)
treebd6363af53bca9bbd3dede1c7ee59615b94eb107 /azalea-client/src
parent1059afa6fcf8b2776fd25dac07ed2e76ab48bed3 (diff)
downloadazalea-drasl-9ee5e71bb13e596248fde000d8717c86276b0ce1.tar.xz
Server functions and proxy example (#59)
* A couple useful things for servers * Add proxy example * Use Uuid's serde feature * Add const options to proxy example * Example crates go in dev-dependencies * Warn instead of error * Log address on login * Requested changes * add a test for deserializing game profile + random small changes Co-authored-by: mat <github@matdoes.dev>
Diffstat (limited to 'azalea-client/src')
-rwxr-xr-xazalea-client/src/account.rs4
-rwxr-xr-xazalea-client/src/chat.rs4
-rw-r--r--azalea-client/src/client.rs8
3 files changed, 8 insertions, 8 deletions
diff --git a/azalea-client/src/account.rs b/azalea-client/src/account.rs
index d1c20cc8..79feb1a7 100755
--- a/azalea-client/src/account.rs
+++ b/azalea-client/src/account.rs
@@ -31,7 +31,7 @@ pub struct Account {
/// This is an Arc<Mutex> so it can be modified by [`Self::refresh`].
pub access_token: Option<Arc<Mutex<String>>>,
/// Only required for online-mode accounts.
- pub uuid: Option<uuid::Uuid>,
+ pub uuid: Option<Uuid>,
/// The parameters (i.e. email) that were passed for creating this
/// [`Account`]. This is used to for automatic reauthentication when we get
@@ -85,7 +85,7 @@ impl Account {
Ok(Self {
username: auth_result.profile.name,
access_token: Some(Arc::new(Mutex::new(auth_result.access_token))),
- uuid: Some(Uuid::parse_str(&auth_result.profile.id).expect("Invalid UUID")),
+ uuid: Some(auth_result.profile.id),
auth_opts: AuthOpts::Microsoft {
email: email.to_string(),
},
diff --git a/azalea-client/src/chat.rs b/azalea-client/src/chat.rs
index 44ad8a71..de71f586 100755
--- a/azalea-client/src/chat.rs
+++ b/azalea-client/src/chat.rs
@@ -77,8 +77,8 @@ impl ChatPacket {
/// player-sent chat message, this will be None.
pub fn uuid(&self) -> Option<Uuid> {
match self {
- ChatPacket::System(_) => return None,
- ChatPacket::Player(m) => return Some(m.sender),
+ ChatPacket::System(_) => None,
+ ChatPacket::Player(m) => Some(m.sender),
}
}
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index dbb1b71e..125facda 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -1,6 +1,6 @@
pub use crate::chat::ChatPacket;
use crate::{movement::WalkDirection, plugins::PluginStates, Account, PlayerInfo};
-use azalea_auth::{game_profile::GameProfile, sessionserver::SessionServerError};
+use azalea_auth::{game_profile::GameProfile, sessionserver::ClientSessionServerError};
use azalea_chat::Component;
use azalea_core::{ChunkPos, ResourceLocation, Vec3};
use azalea_protocol::{
@@ -141,7 +141,7 @@ pub enum JoinError {
#[error("{0}")]
Io(#[from] io::Error),
#[error("{0}")]
- SessionServer(#[from] azalea_auth::sessionserver::SessionServerError),
+ SessionServer(#[from] azalea_auth::sessionserver::ClientSessionServerError),
#[error("The given address could not be parsed into a ServerAddress")]
InvalidAddress,
#[error("Couldn't refresh access token: {0}")]
@@ -315,8 +315,8 @@ impl Client {
}
if matches!(
e,
- SessionServerError::InvalidSession
- | SessionServerError::ForbiddenOperation
+ ClientSessionServerError::InvalidSession
+ | ClientSessionServerError::ForbiddenOperation
) {
// uh oh, we got an invalid session and have
// to reauthenticate now