Skip to content

Commit

Permalink
Add missing configuration and game connection wrappers (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShayBox authored Jul 12, 2024
1 parent ea64fba commit cf4e3f6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions azalea-protocol/src/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit cf4e3f6

Please sign in to comment.