aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol
diff options
context:
space:
mode:
authorShayne Hartford <shaybox@shaybox.com>2024-07-12 02:07:24 -0400
committerGitHub <noreply@github.com>2024-07-12 01:07:24 -0500
commitcf4e3f609d137dd47595560e86a1075a1ce91eff (patch)
tree71070c280d072ea2bbad43c33b6d651d7719ed9b /azalea-protocol
parentea64fba7f655b9afa03d57e8590c16e024f396f3 (diff)
downloadazalea-drasl-cf4e3f609d137dd47595560e86a1075a1ce91eff.tar.xz
Add missing configuration and game connection wrappers (#161)
Diffstat (limited to 'azalea-protocol')
-rwxr-xr-xazalea-protocol/src/connect.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/azalea-protocol/src/connect.rs b/azalea-protocol/src/connect.rs
index 691d25c0..20a145cc 100755
--- a/azalea-protocol/src/connect.rs
+++ b/azalea-protocol/src/connect.rs
@@ -501,6 +501,23 @@ impl Connection<ServerboundLoginPacket, ClientboundLoginPacket> {
) -> Result<GameProfile, ServerSessionServerError> {
azalea_auth::sessionserver::serverside_auth(username, public_key, private_key, ip).await
}
+
+ /// Change our state back to configuration.
+ #[must_use]
+ pub fn configuration(
+ self,
+ ) -> Connection<ServerboundConfigurationPacket, ClientboundConfigurationPacket> {
+ Connection::from(self)
+ }
+}
+
+impl Connection<ServerboundConfigurationPacket, ClientboundConfigurationPacket> {
+ /// Change our state from configuration to game. This is the state that's
+ /// used when the client is actually in the world.
+ #[must_use]
+ pub fn game(self) -> Connection<ServerboundGamePacket, ClientboundGamePacket> {
+ Connection::from(self)
+ }
}
impl Connection<ClientboundConfigurationPacket, ServerboundConfigurationPacket> {