aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-client/src')
-rw-r--r--azalea-client/src/account.rs12
-rw-r--r--azalea-client/src/client.rs4
-rwxr-xr-xazalea-client/src/lib.rs2
3 files changed, 16 insertions, 2 deletions
diff --git a/azalea-client/src/account.rs b/azalea-client/src/account.rs
index 715f2fba..2fedc4f5 100644
--- a/azalea-client/src/account.rs
+++ b/azalea-client/src/account.rs
@@ -6,6 +6,18 @@ use uuid::Uuid;
/// Something that can join Minecraft servers.
///
/// To join a server using this account, use [`crate::Client::join`].
+///
+/// # Examples
+///
+/// ```rust,no_run
+/// use azalea_client::Account;
+///
+/// # #[tokio::main]
+/// # async fn main() {
+/// let account = Account::microsoft("example@example.com").await;
+/// // or Account::offline("example");
+/// # }
+/// ```
#[derive(Clone, Debug)]
pub struct Account {
/// The Minecraft username of the account.
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index ab52b65e..cb87c250 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -1,6 +1,6 @@
use crate::{movement::MoveDirection, Account, Player};
use azalea_auth::game_profile::GameProfile;
-use azalea_chat::component::Component;
+use azalea_chat::Component;
use azalea_core::{ChunkPos, ResourceLocation, Vec3};
use azalea_protocol::{
connect::{Connection, ConnectionError, ReadConnection, WriteConnection},
@@ -62,6 +62,7 @@ pub enum Event {
Packet(Box<ClientboundGamePacket>),
}
+/// A chat packet, either a system message or a chat message.
#[derive(Debug, Clone)]
pub enum ChatPacket {
System(ClientboundSystemChatPacket),
@@ -69,6 +70,7 @@ pub enum ChatPacket {
}
impl ChatPacket {
+ /// Get the message shown in chat for this packet.
pub fn message(&self) -> Component {
match self {
ChatPacket::System(p) => p.content.clone(),
diff --git a/azalea-client/src/lib.rs b/azalea-client/src/lib.rs
index 265fbf8b..c32bd212 100755
--- a/azalea-client/src/lib.rs
+++ b/azalea-client/src/lib.rs
@@ -14,7 +14,7 @@ pub mod ping;
mod player;
pub use account::Account;
-pub use client::{Client, ClientInformation, Event, JoinError};
+pub use client::{ChatPacket, Client, ClientInformation, Event, JoinError};
pub use movement::MoveDirection;
pub use player::Player;