mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix clippy, minor fmt, add TODO comments
This commit is contained in:
parent
39f78e9116
commit
fa45edb541
@ -92,6 +92,7 @@ fn main() -> io::Result<()> {
|
||||
// Load server settings
|
||||
let mut server_settings = server::Settings::load(&server_data_dir);
|
||||
let mut editable_settings = server::EditableSettings::load(&server_data_dir);
|
||||
#[allow(clippy::single_match)] // Note: remove this when there are more subcommands
|
||||
match matches.subcommand() {
|
||||
("admin", Some(sub_m)) => {
|
||||
admin::admin_subcommand(
|
||||
|
@ -934,18 +934,30 @@ impl Server {
|
||||
self.state.ecs().read_storage::<Client>().join().count() as i64
|
||||
}
|
||||
|
||||
// TODO: add Admin comp if ingame
|
||||
pub fn add_admin(&self, username: &str) {
|
||||
let mut editable_settings = self.editable_settings_mut();
|
||||
let login_provider = self.state.ecs().fetch::<LoginProvider>();
|
||||
let data_dir = self.data_dir();
|
||||
add_admin(username, &login_provider, &mut editable_settings, &data_dir.path);
|
||||
add_admin(
|
||||
username,
|
||||
&login_provider,
|
||||
&mut editable_settings,
|
||||
&data_dir.path,
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: remove Admin comp if ingame
|
||||
pub fn remove_admin(&self, username: &str) {
|
||||
let mut editable_settings = self.editable_settings_mut();
|
||||
let login_provider = self.state.ecs().fetch::<LoginProvider>();
|
||||
let data_dir = self.data_dir();
|
||||
remove_admin(username, &login_provider, &mut editable_settings, &data_dir.path);
|
||||
remove_admin(
|
||||
username,
|
||||
&login_provider,
|
||||
&mut editable_settings,
|
||||
&data_dir.path,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -965,7 +977,7 @@ pub fn add_admin(
|
||||
use crate::settings::EditableSetting;
|
||||
match login_provider.username_to_uuid(username) {
|
||||
Ok(uuid) => editable_settings.admins.edit(data_dir, |admins| {
|
||||
if admins.insert(uuid.clone()) {
|
||||
if admins.insert(uuid) {
|
||||
info!("Successfully added {} ({}) as an admin!", username, uuid);
|
||||
} else {
|
||||
info!("{} ({}) is already an admin!", username, uuid);
|
||||
@ -973,8 +985,8 @@ pub fn add_admin(
|
||||
}),
|
||||
Err(err) => error!(
|
||||
?err,
|
||||
"Could not find uuid for this name either the user does not exist or \
|
||||
there was an error communicating with the auth server."
|
||||
"Could not find uuid for this name either the user does not exist or there was an \
|
||||
error communicating with the auth server."
|
||||
),
|
||||
}
|
||||
}
|
||||
@ -999,8 +1011,8 @@ pub fn remove_admin(
|
||||
}),
|
||||
Err(err) => error!(
|
||||
?err,
|
||||
"Could not find uuid for this name either the user does not exist or \
|
||||
there was an error communicating with the auth server."
|
||||
"Could not find uuid for this name either the user does not exist or there was an \
|
||||
error communicating with the auth server."
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ use crate::{
|
||||
};
|
||||
use common::{
|
||||
comp::{
|
||||
Admin, CanBuild, ChatMode, ChatType, ControlEvent, Controller, ForceUpdate, Ori,
|
||||
Player, Pos, Stats, UnresolvedChatMsg, Vel,
|
||||
Admin, CanBuild, ChatMode, ChatType, ControlEvent, Controller, ForceUpdate, Ori, Player,
|
||||
Pos, Stats, UnresolvedChatMsg, Vel,
|
||||
},
|
||||
event::{EventBus, ServerEvent},
|
||||
msg::{
|
||||
|
Loading…
Reference in New Issue
Block a user