From d4fb75d07c9020a20100a5fe48d7a3b357d7798d Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sat, 18 Sep 2021 18:10:47 -0500 Subject: [PATCH] add check to determine whether to include color codes when checking name length --- SharedLibraryCore/PartialEntities/EFClient.cs | 3 ++- SharedLibraryCore/Utilities.cs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/SharedLibraryCore/PartialEntities/EFClient.cs b/SharedLibraryCore/PartialEntities/EFClient.cs index 2fd5d8dd5..4351f1ba9 100644 --- a/SharedLibraryCore/PartialEntities/EFClient.cs +++ b/SharedLibraryCore/PartialEntities/EFClient.cs @@ -457,7 +457,8 @@ namespace SharedLibraryCore.Database.Models using (LogContext.PushProperty("Server", CurrentServer?.ToString())) { - if (string.IsNullOrWhiteSpace(Name) || CleanedName.Replace(" ", "").Length < + var nameToCheck = CurrentServer.IsCodGame() ? CleanedName : Name; + if (string.IsNullOrWhiteSpace(Name) || nameToCheck.Replace(" ", "").Length < (CurrentServer?.Manager?.GetApplicationSettings()?.Configuration()?.MinimumNameLength ?? 3)) { Utilities.DefaultLogger.LogInformation("Kicking {Client} because their name is too short", ToString()); diff --git a/SharedLibraryCore/Utilities.cs b/SharedLibraryCore/Utilities.cs index a56376ea3..a5066776b 100644 --- a/SharedLibraryCore/Utilities.cs +++ b/SharedLibraryCore/Utilities.cs @@ -186,6 +186,8 @@ namespace SharedLibraryCore /// public static bool IsZombieServer(this Server server) => server.GameName == Game.T6 && _zmGameTypes.Contains(server.Gametype.ToLower()); + public static bool IsCodGame(this Server server) => server.RconParser?.RConEngine == "COD"; + /// /// Get the IW Engine color code corresponding to an admin level ///