diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-11-30 21:04:12 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-30 21:04:12 -0600 |
| commit | 6c110f2731c3893af397cc6a660f374ff705c99b (patch) | |
| tree | d3441af29cf40b49d474fc04aa1f426ad4292fa0 /azalea-protocol | |
| parent | 6930966aabf9b49fb6a0dc8b61076fa3f1abc298 (diff) | |
| download | azalea-drasl-6c110f2731c3893af397cc6a660f374ff705c99b.tar.xz | |
Add `online-mode` Cargo feature (#281)
* Add `online-mode` cargo feature
* fix bad formatting in Cargo.toml
Diffstat (limited to 'azalea-protocol')
| -rw-r--r-- | azalea-protocol/Cargo.toml | 3 | ||||
| -rw-r--r-- | azalea-protocol/src/connect.rs | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/azalea-protocol/Cargo.toml b/azalea-protocol/Cargo.toml index 1ab25a12..4128faae 100644 --- a/azalea-protocol/Cargo.toml +++ b/azalea-protocol/Cargo.toml @@ -43,9 +43,10 @@ uuid.workspace = true indexmap.workspace = true [features] +default = ["packets", "online-mode"] connecting = [] -default = ["packets"] packets = ["connecting", "dep:azalea-core"] +online-mode = ["azalea-auth/online-mode"] [lints] workspace = true diff --git a/azalea-protocol/src/connect.rs b/azalea-protocol/src/connect.rs index febb2337..556f0f1c 100644 --- a/azalea-protocol/src/connect.rs +++ b/azalea-protocol/src/connect.rs @@ -7,6 +7,7 @@ use std::{ net::SocketAddr, }; +#[cfg(feature = "online-mode")] use azalea_auth::{ game_profile::GameProfile, sessionserver::{ClientSessionServerError, ServerSessionServerError}, @@ -21,15 +22,18 @@ use tokio::{ }, }; use tracing::{error, info}; +#[cfg(feature = "online-mode")] use uuid::Uuid; +#[cfg(feature = "online-mode")] +use crate::packets::login::ClientboundHello; use crate::{ packets::{ ProtocolPacket, config::{ClientboundConfigPacket, ServerboundConfigPacket}, game::{ClientboundGamePacket, ServerboundGamePacket}, handshake::{ClientboundHandshakePacket, ServerboundHandshakePacket}, - login::{ClientboundLoginPacket, ServerboundLoginPacket, c_hello::ClientboundHello}, + login::{ClientboundLoginPacket, ServerboundLoginPacket}, status::{ClientboundStatusPacket, ServerboundStatusPacket}, }, read::{ReadPacketError, deserialize_packet, read_raw_packet, try_read_raw_packet}, @@ -453,6 +457,7 @@ impl Connection<ClientboundLoginPacket, ServerboundLoginPacket> { /// # Ok(()) /// # } /// ``` + #[cfg(feature = "online-mode")] pub async fn authenticate( &self, access_token: &str, @@ -526,6 +531,7 @@ impl Connection<ServerboundLoginPacket, ClientboundLoginPacket> { /// Verify connecting clients have authenticated with Minecraft's servers. /// This must happen after the client sends a `ServerboundLoginPacket::Key` /// packet. + #[cfg(feature = "online-mode")] pub async fn authenticate( &self, username: &str, |
