1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 23:31:13 -05:00

update stats plugin to IPluginV2

This commit is contained in:
RaidMax
2023-02-11 21:01:28 -06:00
parent f1e8fb9b34
commit b04d059399
19 changed files with 1388 additions and 1326 deletions

View File

@ -7,15 +7,18 @@ using System.Linq;
using System.Threading.Tasks;
using Data.Abstractions;
using Data.Models.Client.Stats;
using IW4MAdmin.Plugins.Stats.Helpers;
using Stats.Config;
namespace IW4MAdmin.Plugins.Stats.Commands
{
public class ResetStats : Command
{
private readonly IDatabaseContextFactory _contextFactory;
private readonly StatManager _statManager;
public ResetStats(CommandConfiguration config, ITranslationLookup translationLookup,
IDatabaseContextFactory contextFactory) : base(config, translationLookup)
IDatabaseContextFactory contextFactory, StatManager statManager) : base(config, translationLookup)
{
Name = "resetstats";
Description = translationLookup["PLUGINS_STATS_COMMANDS_RESET_DESC"];
@ -25,6 +28,7 @@ namespace IW4MAdmin.Plugins.Stats.Commands
AllowImpersonation = true;
_contextFactory = contextFactory;
_statManager = statManager;
}
public override async Task ExecuteAsync(GameEvent gameEvent)
@ -53,7 +57,7 @@ namespace IW4MAdmin.Plugins.Stats.Commands
}
// reset the cached version
Plugin.Manager.ResetStats(gameEvent.Origin);
_statManager.ResetStats(gameEvent.Origin);
gameEvent.Origin.Tell(_translationLookup["PLUGINS_STATS_COMMANDS_RESET_SUCCESS"]);
}