Clean up help message and if-let

Former-commit-id: 450281467a92b2b8186df74d83d108457513277a
This commit is contained in:
sxv20_ 2019-04-16 15:31:14 +01:00
parent 031e4b36d6
commit f8d75d900e

View File

@ -486,21 +486,20 @@ impl Server {
.find(|(_, player)| player.alias == alias) .find(|(_, player)| player.alias == alias)
.map(|(entity, _)| entity); .map(|(entity, _)| entity);
match opt_player { match opt_player {
Some(player) => { Some(player) => match self
if let Some(pos) = .state
self.state.read_component_cloned::<comp::phys::Pos>(player) .read_component_cloned::<comp::phys::Pos>(player)
{ {
self.state.write_component(entity, pos); Some(pos) => self.state.write_component(entity, pos),
} else { None => self.clients.notify(
self.clients.notify( entity,
entity, ServerMsg::Chat(format!(
ServerMsg::Chat(format!( "Unable to teleport to player '{}'",
"Unable to teleport to player '{}'", alias
alias )),
)), ),
); },
}
}
None => { None => {
self.clients.notify( self.clients.notify(
entity, entity,
@ -531,7 +530,8 @@ impl Server {
self.clients.notify( self.clients.notify(
entity, entity,
ServerMsg::Chat(format!( ServerMsg::Chat(format!(
"Unrecognised command: '/{}'\nAvailable commands:", "Unrecognised command: '/{}'\n
type '/help' for a list of available commands",
kwd kwd
)), )),
); );