add check to determine whether to include color codes when checking name length

This commit is contained in:
RaidMax 2021-09-18 18:10:47 -05:00
parent e97119211f
commit d4fb75d07c
2 changed files with 4 additions and 1 deletions

View File

@ -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());

View File

@ -186,6 +186,8 @@ namespace SharedLibraryCore
/// <returns></returns>
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";
/// <summary>
/// Get the IW Engine color code corresponding to an admin level
/// </summary>