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