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();
var commandConfigHandler = new BaseConfigurationHandler<CommandConfiguration>("CommandConfiguration");
await commandConfigHandler.BuildAsync();
var statsCommandHandler = new BaseConfigurationHandler<StatsConfiguration>();
var statsCommandHandler = new BaseConfigurationHandler<StatsConfiguration>("StatsPluginSettings");
await statsCommandHandler.BuildAsync();
var defaultConfig = defaultConfigHandler.Configuration();
var appConfig = appConfigHandler.Configuration();

View File

@ -18,28 +18,27 @@ namespace Stats.Config
public int MostKillsClientLimit { get; set; } = 5;
public bool EnableAdvancedMetrics { get; set; } = true;
public WeaponNameParserConfiguration[] WeaponNameParserConfigurations { get; set; } = new[]
{
new WeaponNameParserConfiguration()
public WeaponNameParserConfiguration[] WeaponNameParserConfigurations { get; set; } = {
new()
{
Game = Server.Game.IW3,
WeaponSuffix = "mp",
Delimiters = new[] {'_'}
},
new WeaponNameParserConfiguration()
new()
{
Game = Server.Game.IW4,
WeaponSuffix = "mp",
Delimiters = new[] {'_'}
},
new WeaponNameParserConfiguration()
new()
{
Game = Server.Game.IW5,
WeaponSuffix = "mp",
WeaponPrefix = "iw5",
Delimiters = new[] {'_'}
},
new WeaponNameParserConfiguration()
new()
{
Game = Server.Game.T6,
WeaponSuffix = "mp",
@ -48,7 +47,7 @@ namespace Stats.Config
};
[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
public void ApplyMigration()
@ -77,22 +76,22 @@ namespace Stats.Config
Utilities.CurrentLocalization.LocalizationIndex["PLUGIN_STATS_SETUP_ENABLEAC"].PromptBool();
KillstreakMessages = new List<StreakMessageConfiguration>
{
new StreakMessageConfiguration
new()
{
Count = -1,
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_SUICIDE"]
},
new StreakMessageConfiguration
new()
{
Count = 5,
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_5"]
},
new StreakMessageConfiguration
new()
{
Count = 10,
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_10"]
},
new StreakMessageConfiguration
new()
{
Count = 25,
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_25"]
@ -101,12 +100,12 @@ namespace Stats.Config
DeathstreakMessages = new List<StreakMessageConfiguration>()
{
new StreakMessageConfiguration()
new()
{
Count = 5,
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_DEATH_STREAK_MESSAGE_5"]
},
new StreakMessageConfiguration()
new()
{
Count = 10,
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_DEATH_STREAK_MESSAGE_10"]
@ -119,4 +118,4 @@ namespace Stats.Config
return this;
}
}
}
}