fix issue with loading stats config #237

This commit is contained in:
RaidMax 2022-03-08 11:24:59 -06:00
parent 42313b7816
commit e32e97b9e6
2 changed files with 14 additions and 15 deletions

View File

@ -348,7 +348,7 @@ namespace IW4MAdmin.Application
await defaultConfigHandler.BuildAsync(); await defaultConfigHandler.BuildAsync();
var commandConfigHandler = new BaseConfigurationHandler<CommandConfiguration>("CommandConfiguration"); var commandConfigHandler = new BaseConfigurationHandler<CommandConfiguration>("CommandConfiguration");
await commandConfigHandler.BuildAsync(); await commandConfigHandler.BuildAsync();
var statsCommandHandler = new BaseConfigurationHandler<StatsConfiguration>(); var statsCommandHandler = new BaseConfigurationHandler<StatsConfiguration>("StatsPluginSettings");
await statsCommandHandler.BuildAsync(); await statsCommandHandler.BuildAsync();
var defaultConfig = defaultConfigHandler.Configuration(); var defaultConfig = defaultConfigHandler.Configuration();
var appConfig = appConfigHandler.Configuration(); var appConfig = appConfigHandler.Configuration();

View File

@ -18,28 +18,27 @@ namespace Stats.Config
public int MostKillsClientLimit { get; set; } = 5; public int MostKillsClientLimit { get; set; } = 5;
public bool EnableAdvancedMetrics { get; set; } = true; public bool EnableAdvancedMetrics { get; set; } = true;
public WeaponNameParserConfiguration[] WeaponNameParserConfigurations { get; set; } = new[] public WeaponNameParserConfiguration[] WeaponNameParserConfigurations { get; set; } = {
{ new()
new WeaponNameParserConfiguration()
{ {
Game = Server.Game.IW3, Game = Server.Game.IW3,
WeaponSuffix = "mp", WeaponSuffix = "mp",
Delimiters = new[] {'_'} Delimiters = new[] {'_'}
}, },
new WeaponNameParserConfiguration() new()
{ {
Game = Server.Game.IW4, Game = Server.Game.IW4,
WeaponSuffix = "mp", WeaponSuffix = "mp",
Delimiters = new[] {'_'} Delimiters = new[] {'_'}
}, },
new WeaponNameParserConfiguration() new()
{ {
Game = Server.Game.IW5, Game = Server.Game.IW5,
WeaponSuffix = "mp", WeaponSuffix = "mp",
WeaponPrefix = "iw5", WeaponPrefix = "iw5",
Delimiters = new[] {'_'} Delimiters = new[] {'_'}
}, },
new WeaponNameParserConfiguration() new()
{ {
Game = Server.Game.T6, Game = Server.Game.T6,
WeaponSuffix = "mp", WeaponSuffix = "mp",
@ -48,7 +47,7 @@ namespace Stats.Config
}; };
[Obsolete] public IDictionary<long, DetectionType[]> ServerDetectionTypes { get; set; } [Obsolete] public IDictionary<long, DetectionType[]> ServerDetectionTypes { get; set; }
public AnticheatConfiguration AnticheatConfiguration { get; set; } = new AnticheatConfiguration(); public AnticheatConfiguration AnticheatConfiguration { get; set; } = new();
#pragma warning disable CS0612 // Type or member is obsolete #pragma warning disable CS0612 // Type or member is obsolete
public void ApplyMigration() public void ApplyMigration()
@ -77,22 +76,22 @@ namespace Stats.Config
Utilities.CurrentLocalization.LocalizationIndex["PLUGIN_STATS_SETUP_ENABLEAC"].PromptBool(); Utilities.CurrentLocalization.LocalizationIndex["PLUGIN_STATS_SETUP_ENABLEAC"].PromptBool();
KillstreakMessages = new List<StreakMessageConfiguration> KillstreakMessages = new List<StreakMessageConfiguration>
{ {
new StreakMessageConfiguration new()
{ {
Count = -1, Count = -1,
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_SUICIDE"] Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_SUICIDE"]
}, },
new StreakMessageConfiguration new()
{ {
Count = 5, Count = 5,
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_5"] Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_5"]
}, },
new StreakMessageConfiguration new()
{ {
Count = 10, Count = 10,
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_10"] Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_10"]
}, },
new StreakMessageConfiguration new()
{ {
Count = 25, Count = 25,
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_25"] Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_25"]
@ -101,12 +100,12 @@ namespace Stats.Config
DeathstreakMessages = new List<StreakMessageConfiguration>() DeathstreakMessages = new List<StreakMessageConfiguration>()
{ {
new StreakMessageConfiguration() new()
{ {
Count = 5, Count = 5,
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_DEATH_STREAK_MESSAGE_5"] Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_DEATH_STREAK_MESSAGE_5"]
}, },
new StreakMessageConfiguration() new()
{ {
Count = 10, Count = 10,
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_DEATH_STREAK_MESSAGE_10"] Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_DEATH_STREAK_MESSAGE_10"]