aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/account.rs
blob: 00a5d0f631abb1e9b42edca7f16a7ce51a87d5f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use crate::Client;
use azalea_protocol::{
    packets::game::{
        clientbound_player_chat_packet::ClientboundPlayerChatPacket,
        clientbound_system_chat_packet::ClientboundSystemChatPacket,
    },
    ServerAddress,
};
use std::fmt::Debug;

///! Connect to Minecraft servers.

/// Something that can join Minecraft servers.
pub struct Account {
    pub username: String,
}
impl Account {
    pub fn offline(username: &str) -> Self {
        Self {
            username: username.to_string(),
        }
    }

    pub async fn join(&self, address: &ServerAddress) -> Result<Client, String> {
        Client::join(self, address).await
    }
}