Handle LoginSuccess_UUID, split LoginSuccess_String
This commit is contained in:
parent
ae3bdaed16
commit
d6ee4b6e1e
|
@ -1984,7 +1984,7 @@ state_packets!(
|
|||
/// LoginSuccess is sent by the server if the player successfully
|
||||
/// authenicates with the session servers (online mode) or straight
|
||||
/// after LoginStart (offline mode).
|
||||
packet LoginSuccess {
|
||||
packet LoginSuccess_String {
|
||||
/// String encoding of a uuid (with hyphens)
|
||||
field uuid: String =,
|
||||
field username: String =,
|
||||
|
|
|
@ -122,7 +122,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
0x04 => LoginPluginRequest
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
0x04 => LoginPluginRequest
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
0x04 => LoginPluginRequest
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
0x04 => LoginPluginRequest
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
0x04 => LoginPluginRequest
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
0x04 => LoginPluginRequest
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
0x04 => LoginPluginRequest
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
0x04 => LoginPluginRequest
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
0x04 => LoginPluginRequest
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest_i16
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
}
|
||||
}
|
||||
status Status {
|
||||
|
|
|
@ -120,7 +120,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ protocol_packet_ids!(
|
|||
clientbound Clientbound {
|
||||
0x00 => LoginDisconnect
|
||||
0x01 => EncryptionRequest
|
||||
0x02 => LoginSuccess
|
||||
0x02 => LoginSuccess_String
|
||||
0x03 => SetInitialCompression
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ impl Server {
|
|||
verify_token = Rc::new(val.verify_token.data);
|
||||
break;
|
||||
}
|
||||
protocol::packet::Packet::LoginSuccess(val) => {
|
||||
protocol::packet::Packet::LoginSuccess_String(val) => {
|
||||
warn!("Server is running in offline mode");
|
||||
debug!("Login: {} {}", val.username, val.uuid);
|
||||
let mut read = conn.clone();
|
||||
|
@ -164,6 +164,24 @@ impl Server {
|
|||
Some(rx),
|
||||
));
|
||||
}
|
||||
// TODO: avoid duplication
|
||||
protocol::packet::Packet::LoginSuccess_UUID(val) => {
|
||||
warn!("Server is running in offline mode");
|
||||
debug!("Login: {} {:?}", val.username, val.uuid);
|
||||
let mut read = conn.clone();
|
||||
let mut write = conn.clone();
|
||||
read.state = protocol::State::Play;
|
||||
write.state = protocol::State::Play;
|
||||
let rx = Self::spawn_reader(read);
|
||||
return Ok(Server::new(
|
||||
protocol_version,
|
||||
forge_mods,
|
||||
val.uuid,
|
||||
resources,
|
||||
Some(write),
|
||||
Some(rx),
|
||||
));
|
||||
}
|
||||
protocol::packet::Packet::LoginDisconnect(val) => {
|
||||
return Err(protocol::Error::Disconnect(val.reason))
|
||||
}
|
||||
|
@ -210,8 +228,15 @@ impl Server {
|
|||
read.set_compresssion(val.threshold.0);
|
||||
write.set_compresssion(val.threshold.0);
|
||||
}
|
||||
protocol::packet::Packet::LoginSuccess(val) => {
|
||||
protocol::packet::Packet::LoginSuccess_String(val) => {
|
||||
debug!("Login: {} {}", val.username, val.uuid);
|
||||
uuid = protocol::UUID::from_str(&val.uuid);
|
||||
read.state = protocol::State::Play;
|
||||
write.state = protocol::State::Play;
|
||||
break;
|
||||
}
|
||||
protocol::packet::Packet::LoginSuccess_UUID(val) => {
|
||||
debug!("Login: {} {:?}", val.username, val.uuid);
|
||||
uuid = val.uuid;
|
||||
read.state = protocol::State::Play;
|
||||
write.state = protocol::State::Play;
|
||||
|
@ -229,7 +254,7 @@ impl Server {
|
|||
Ok(Server::new(
|
||||
protocol_version,
|
||||
forge_mods,
|
||||
protocol::UUID::from_str(&uuid),
|
||||
uuid,
|
||||
resources,
|
||||
Some(write),
|
||||
Some(rx),
|
||||
|
|
Loading…
Reference in New Issue