fixed the silent kick, made it actually proper

This commit is contained in:
telastrus 2019-08-08 17:58:36 -04:00
parent 3a9bbc4927
commit 07d3384b01
3 changed files with 10 additions and 12 deletions

View File

@ -132,23 +132,19 @@ impl Client {
}
/// Request a state transition to `ClientState::Registered`.
pub fn register(&mut self, player: comp::Player, password: String) /*-> Result<(), Error>*/
{
pub fn register(&mut self, player: comp::Player, password: String) -> Result<(), Error> {
self.postbox
.send_message(ClientMsg::Register { player, password });
self.client_state = ClientState::Pending;
/*loop {
loop {
match self.postbox.next_message() {
Some(ServerMsg::StateAnswer(Err((RequestStateError::Denied, _)))) => {
break Err(Error::InvalidAuth)
},
Some(ServerMsg::StateAnswer(Ok(ClientState::Registered))) => {
break Ok(())
}
Some(ServerMsg::StateAnswer(Ok(ClientState::Registered))) => break Ok(()),
_ => {}
}
}*/
}
}
/// Request a state transition to `ClientState::Character`.

View File

@ -62,11 +62,13 @@ impl ClientInit {
for socket_addr in first_addrs.into_iter().chain(second_addrs) {
match Client::new(socket_addr, player.view_distance) {
Ok(mut client) => {
/*if let Err(ClientError::InvalidAuth) == client.register(player, password) {
if let Err(ClientError::InvalidAuth) =
client.register(player, password)
{
last_err = Some(Error::InvalidAuth);
break;
}*/
client.register(player, password);
}
//client.register(player, password);
let _ = tx.send(Ok(client));
#[cfg(feature = "discord")]

View File

@ -64,7 +64,7 @@ impl PlayState for MainMenuState {
self.main_menu_ui.login_error(
match err {
InitError::BadAddress(_) | InitError::NoAddress => "Server not found",
InitError::InvalidAuth => "Invalid username or password",
InitError::InvalidAuth => "Invalid credentials",
InitError::ServerIsFull => "Server is Full!",
InitError::ConnectionFailed(_) => "Connection failed",
InitError::ClientCrashed => "Client crashed",