From 6c110f2731c3893af397cc6a660f374ff705c99b Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Sun, 30 Nov 2025 21:04:12 -0600 Subject: Add `online-mode` Cargo feature (#281) * Add `online-mode` cargo feature * fix bad formatting in Cargo.toml --- azalea-protocol/src/connect.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'azalea-protocol/src') 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 { /// # Ok(()) /// # } /// ``` + #[cfg(feature = "online-mode")] pub async fn authenticate( &self, access_token: &str, @@ -526,6 +531,7 @@ impl Connection { /// 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, -- cgit v1.2.3