mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added ban command functionality
This commit is contained in:
parent
dadb1fbe12
commit
def21af02b
@ -1860,13 +1860,29 @@ fn handle_ban(
|
||||
server: &mut Server,
|
||||
client: EcsEntity,
|
||||
_target: EcsEntity,
|
||||
_args: String,
|
||||
_action: &ChatCommand,
|
||||
args: String,
|
||||
action: &ChatCommand,
|
||||
) {
|
||||
server.notify_client(
|
||||
client,
|
||||
ChatType::CommandInfo.server_msg("This command is not yet implemented")
|
||||
)
|
||||
if let (Some(target_alias), reason_opt) = scan_fmt_some!(&args, &action.arg_fmt(), String, String) {
|
||||
let reason = reason_opt.unwrap_or(String::new());
|
||||
|
||||
server.settings_mut().edit(|s| {
|
||||
s.banlist.push((target_alias.clone(), reason.clone()))
|
||||
});
|
||||
|
||||
server.notify_client(
|
||||
client,
|
||||
ChatType::CommandInfo.server_msg(
|
||||
format!("Added {} to the banlist with reason: {}",
|
||||
target_alias,
|
||||
reason))
|
||||
);
|
||||
} else {
|
||||
server.notify_client(
|
||||
client,
|
||||
ChatType::CommandError.server_msg(action.help_string())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_unban(
|
||||
|
@ -20,7 +20,7 @@ pub struct ServerSettings {
|
||||
pub start_time: f64,
|
||||
pub admins: Vec<String>,
|
||||
pub whitelist: Vec<String>,
|
||||
pub banlist: Vec<String>,
|
||||
pub banlist: Vec<(String, String)>,
|
||||
/// When set to None, loads the default map file (if available); otherwise,
|
||||
/// uses the value of the file options to decide how to proceed.
|
||||
pub map_file: Option<FileOpts>,
|
||||
|
Loading…
Reference in New Issue
Block a user