From 539050d95f7fc7c76a848c3b69575c45dc49a43e Mon Sep 17 00:00:00 2001 From: RaidMax Date: Thu, 14 Sep 2023 21:40:35 -0500 Subject: [PATCH] add clear all reports command --- .../Commands/ClearAllReportsCommand.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Application/Commands/ClearAllReportsCommand.cs diff --git a/Application/Commands/ClearAllReportsCommand.cs b/Application/Commands/ClearAllReportsCommand.cs new file mode 100644 index 00000000..b78b55e1 --- /dev/null +++ b/Application/Commands/ClearAllReportsCommand.cs @@ -0,0 +1,31 @@ +using System.Threading.Tasks; +using Data.Models.Client; +using SharedLibraryCore; +using SharedLibraryCore.Configuration; +using SharedLibraryCore.Interfaces; + +namespace IW4MAdmin.Application.Commands; + +public class ClearAllReportsCommand : Command +{ + public ClearAllReportsCommand(CommandConfiguration config, ITranslationLookup layout) : base(config, layout) + { + Name = "clearallreports"; + Description = _translationLookup["COMMANDS_REPORTS_CLEAR_DESC"]; + Alias = "car"; + Permission = EFClient.Permission.Administrator; + RequiresTarget = false; + } + + public override Task ExecuteAsync(GameEvent gameEvent) + { + foreach (var server in gameEvent.Owner.Manager.GetServers()) + { + server.Reports.Clear(); + } + + gameEvent.Origin.Tell(_translationLookup["COMMANDS_REPORTS_CLEAR_SUCCESS"]); + + return Task.CompletedTask; + } +}