blob: c554908fb38668705a66d51f7a04178bfa9f820b (
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
|
//! Connect to Minecraft servers.
use crate::{client::JoinError, Client, Event};
use azalea_protocol::ServerAddress;
use tokio::sync::mpsc::UnboundedReceiver;
/// 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(),
}
}
/// Joins the Minecraft server on the given address using this account.
pub async fn join(
&self,
address: &ServerAddress,
) -> Result<(Client, UnboundedReceiver<Event>), JoinError> {
Client::join(self, address).await
}
}
|