Skip to content

Commit

Permalink
add clear all reports command
Browse files Browse the repository at this point in the history
  • Loading branch information
RaidMax committed Sep 15, 2023
1 parent 7ecbf85 commit 539050d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Application/Commands/ClearAllReportsCommand.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit 539050d

Please sign in to comment.