diff --git a/Application/ApplicationManager.cs b/Application/ApplicationManager.cs index fbdc44b8a..170c11e6a 100644 --- a/Application/ApplicationManager.cs +++ b/Application/ApplicationManager.cs @@ -259,6 +259,7 @@ namespace IW4MAdmin.Application newConfig.AutoMessages = defaultConfig.AutoMessages; newConfig.GlobalRules = defaultConfig.GlobalRules; newConfig.Maps = defaultConfig.Maps; + newConfig.DisallowedClientNames = defaultConfig.DisallowedClientNames; newConfig.QuickMessages = defaultConfig.QuickMessages; if (newConfig.Servers == null) @@ -287,7 +288,7 @@ namespace IW4MAdmin.Application } } - else if (config != null) + else { if (string.IsNullOrEmpty(config.Id)) { @@ -323,7 +324,7 @@ namespace IW4MAdmin.Application } } - else if (config.Servers.Count == 0) + if (config.Servers.Count == 0) { throw new ServerException("A server configuration in IW4MAdminSettings.json is invalid"); } diff --git a/Application/DefaultSettings.json b/Application/DefaultSettings.json index 657eacccf..bd953c342 100644 --- a/Application/DefaultSettings.json +++ b/Application/DefaultSettings.json @@ -16,6 +16,7 @@ "Keep grenade launcher use to a minimum", "Balance teams at ALL times" ], + "DisallowedClientNames": ["Unknown Soldier", "VickNet", "UnknownSoldier", "CHEATER"], "QuickMessages": [ { "Game": "IW4", diff --git a/Plugins/Stats/Controllers/StatsController.cs b/Plugins/Stats/Controllers/StatsController.cs index e28ea18c4..7e882964b 100644 --- a/Plugins/Stats/Controllers/StatsController.cs +++ b/Plugins/Stats/Controllers/StatsController.cs @@ -54,10 +54,11 @@ namespace IW4MAdmin.Plugins.Stats.Web.Controllers } [HttpGet] - public async Task GetMessageAsync(int serverId, DateTime when) + public async Task GetMessageAsync(int serverId, long when) { - var whenUpper = when.AddMinutes(5); - var whenLower = when.AddMinutes(-5); + var whenTime = DateTime.FromFileTimeUtc(when); + var whenUpper = whenTime.AddMinutes(5); + var whenLower = whenTime.AddMinutes(-5); using (var ctx = new SharedLibraryCore.Database.DatabaseContext(true)) { diff --git a/SharedLibraryCore/Commands/NativeCommands.cs b/SharedLibraryCore/Commands/NativeCommands.cs index fb81f7683..38aec069c 100644 --- a/SharedLibraryCore/Commands/NativeCommands.cs +++ b/SharedLibraryCore/Commands/NativeCommands.cs @@ -1219,6 +1219,11 @@ namespace SharedLibraryCore.Commands public override Task ExecuteAsync(GameEvent E) { + if (E.Target == null) + { + E.Target = E.Owner.GetClientByName(E.Data).FirstOrDefault(); + } + if (E.Message.IsBroadcastCommand()) { if (E.Target == null) diff --git a/SharedLibraryCore/Configuration/DefaultConfiguration.cs b/SharedLibraryCore/Configuration/DefaultConfiguration.cs index 38b2b3dcd..9a2b17dfb 100644 --- a/SharedLibraryCore/Configuration/DefaultConfiguration.cs +++ b/SharedLibraryCore/Configuration/DefaultConfiguration.cs @@ -11,6 +11,7 @@ namespace SharedLibraryCore.Configuration public List GlobalRules { get; set; } public List Maps { get; set; } public List QuickMessages {get; set;} + public List DisallowedClientNames { get; set; } public IBaseConfiguration Generate() => this; diff --git a/SharedLibraryCore/Services/MetaService.cs b/SharedLibraryCore/Services/MetaService.cs index fee9a77e4..36a8bb907 100644 --- a/SharedLibraryCore/Services/MetaService.cs +++ b/SharedLibraryCore/Services/MetaService.cs @@ -22,6 +22,12 @@ namespace SharedLibraryCore.Services /// public async Task AddPersistentMeta(string metaKey, string metaValue, EFClient client) { + // this seems to happen if the client disconnects before they've had time to authenticate and be added + if (client.ClientId < 1) + { + return; + } + using (var ctx = new DatabaseContext()) { var existingMeta = await ctx.EFMeta diff --git a/WebfrontCore/Views/Shared/Components/ProfileMetaList/_List.cshtml b/WebfrontCore/Views/Shared/Components/ProfileMetaList/_List.cshtml index 714bbd3cf..4d973d934 100644 --- a/WebfrontCore/Views/Shared/Components/ProfileMetaList/_List.cshtml +++ b/WebfrontCore/Views/Shared/Components/ProfileMetaList/_List.cshtml @@ -55,7 +55,7 @@ case SharedLibraryCore.Dtos.ProfileMeta.MetaType.ChatMessage:
> - @meta.Value + @meta.Value
break; case SharedLibraryCore.Dtos.ProfileMeta.MetaType.ReceivedPenalty: