mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added main menu kick message with kick reason after player is kicked
This commit is contained in:
parent
fee79720ee
commit
30c3146682
@ -142,6 +142,7 @@ https://account.veloren.net."#,
|
||||
"main.login.client_crashed": "Client crashed",
|
||||
"main.login.not_on_whitelist": "You need a Whitelist entry by an Admin to join",
|
||||
"main.login.banned": "You have been banned with the following reason",
|
||||
"main.login.kicked": "You have been kicked with the following reason",
|
||||
|
||||
/// End Main screen section
|
||||
|
||||
|
@ -17,6 +17,7 @@ pub enum Error {
|
||||
AuthClientError(AuthClientError),
|
||||
AuthServerNotTrusted,
|
||||
Banned(String),
|
||||
Kicked(String),
|
||||
/// Persisted character data is invalid or missing
|
||||
InvalidCharacter,
|
||||
//TODO: InvalidAlias,
|
||||
|
@ -59,6 +59,7 @@ pub enum Event {
|
||||
Disconnect,
|
||||
DisconnectionNotification(u64),
|
||||
InventoryUpdated(InventoryUpdateEvent),
|
||||
Kicked(String),
|
||||
Notification(Notification),
|
||||
SetViewDistance(u32),
|
||||
Outcome(Outcome),
|
||||
@ -1395,6 +1396,10 @@ impl Client {
|
||||
self.singleton_stream.send(ClientMsg::Terminate)?;
|
||||
break Ok(());
|
||||
},
|
||||
ServerMsg::Kicked(reason) => {
|
||||
frontend_events.push(Event::Kicked(reason.clone()));
|
||||
self.singleton_stream.send(ClientMsg::Terminate)?;
|
||||
}
|
||||
ServerMsg::CharacterListUpdate(character_list) => {
|
||||
self.character_list.characters = character_list;
|
||||
self.character_list.loading = false;
|
||||
|
@ -239,6 +239,7 @@ pub enum ServerMsg {
|
||||
},
|
||||
TerrainBlockUpdates(HashMap<Vec3<i32>, Block>),
|
||||
Disconnect,
|
||||
Kicked(String),
|
||||
Shutdown,
|
||||
TooManyPlayers,
|
||||
/// Send a popup notification such as "Waypoint Saved"
|
||||
|
@ -1832,7 +1832,7 @@ fn handle_kick(
|
||||
if let Some(target_player) = target_player_opt {
|
||||
server.notify_client(
|
||||
target_player,
|
||||
ServerMsg::Disconnect
|
||||
ServerMsg::Kicked(reason.clone())
|
||||
);
|
||||
server.notify_client(
|
||||
client,
|
||||
|
@ -132,6 +132,13 @@ impl PlayState for MainMenuState {
|
||||
reason
|
||||
)
|
||||
},
|
||||
client::Error::Kicked(reason) => {
|
||||
format!(
|
||||
"{}: {}",
|
||||
localized_strings.get("main.login.kicked"),
|
||||
reason
|
||||
)
|
||||
}
|
||||
client::Error::InvalidCharacter => {
|
||||
localized_strings.get("main.login.invalid_character").into()
|
||||
},
|
||||
|
@ -163,6 +163,16 @@ impl SessionState {
|
||||
message,
|
||||
});
|
||||
},
|
||||
client::Event::Kicked(reason) => {
|
||||
global_state.info_message = Some(
|
||||
format!(
|
||||
"{}: {}",
|
||||
self.voxygen_i18n.get("main.login.kicked").to_string(),
|
||||
reason
|
||||
)
|
||||
);
|
||||
return Ok(TickAction::Disconnect)
|
||||
},
|
||||
client::Event::Notification(n) => {
|
||||
self.hud.new_notification(n);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user