aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/lib.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2024-04-09 07:15:30 +0000
committermat <git@matdoes.dev>2024-04-09 07:15:33 +0000
commitb66b5b6b9042c3817ebb6d426c5ecd523b271c32 (patch)
treee975035ef35c3fa4b18fe957ebe491eccc61c3e5 /azalea/src/lib.rs
parentcadc5605ec143d391382a77a431b55b44f5c5153 (diff)
downloadazalea-drasl-b66b5b6b9042c3817ebb6d426c5ecd523b271c32.tar.xz
add functions to ClientBuilder and SwarmBuilder for custom addresses
Diffstat (limited to 'azalea/src/lib.rs')
-rw-r--r--azalea/src/lib.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs
index 84c215d5..6e18ff7d 100644
--- a/azalea/src/lib.rs
+++ b/azalea/src/lib.rs
@@ -15,6 +15,8 @@ pub mod pathfinder;
pub mod prelude;
pub mod swarm;
+use std::net::SocketAddr;
+
use app::Plugins;
pub use azalea_auth as auth;
pub use azalea_block as blocks;
@@ -189,6 +191,25 @@ where
}
self.swarm.start(address).await
}
+
+ /// Do the same as [`Self::start`], but allow passing in a custom resolved
+ /// address. This is useful if the address you're connecting to doesn't
+ /// resolve to anything, like if the server uses the address field to pass
+ /// custom data (like Bungeecord or Forge).
+ pub async fn start_with_custom_resolved_address(
+ mut self,
+ account: Account,
+ address: impl TryInto<ServerAddress>,
+ resolved_address: SocketAddr,
+ ) -> Result<!, StartError> {
+ self.swarm.accounts = vec![account];
+ if self.swarm.states.is_empty() {
+ self.swarm.states = vec![S::default()];
+ }
+ self.swarm
+ .start_with_custom_resolved_address(address, resolved_address)
+ .await
+ }
}
impl Default for ClientBuilder<NoState> {
fn default() -> Self {