diff --git a/Application/RConParsers/BaseRConParser.cs b/Application/RConParsers/BaseRConParser.cs index 2740f0b8c..238ebb236 100644 --- a/Application/RConParsers/BaseRConParser.cs +++ b/Application/RConParsers/BaseRConParser.cs @@ -80,6 +80,7 @@ namespace IW4MAdmin.Application.RConParsers public async Task ExecuteCommandAsync(IRConConnection connection, string command, CancellationToken token = default) { + command = command.FormatMessageForEngine(Configuration?.ColorCodeMapping); var response = await connection.SendQueryAsync(StaticHelpers.QueryType.COMMAND, command, token); return response.Where(item => item != Configuration.CommandPrefixes.RConResponse).ToArray(); } diff --git a/SharedLibraryCore/Server.cs b/SharedLibraryCore/Server.cs index 5b4efb27f..42cddeff8 100644 --- a/SharedLibraryCore/Server.cs +++ b/SharedLibraryCore/Server.cs @@ -222,7 +222,7 @@ namespace SharedLibraryCore public GameEvent Broadcast(string message, EFClient sender = null) { var formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Say ?? "", - $"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{message.FormatMessageForEngine(RconParser.Configuration.ColorCodeMapping)}"); + $"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{message}"); ServerLogger.LogDebug("All-> {Message}", message.FormatMessageForEngine(RconParser.Configuration.ColorCodeMapping).StripColors()); @@ -270,8 +270,6 @@ namespace SharedLibraryCore /// EFClient to send message to protected async Task Tell(string message, EFClient targetClient) { - var engineMessage = message.FormatMessageForEngine(RconParser.Configuration.ColorCodeMapping); - if (!Utilities.IsDevelopment) { var temporalClientId = targetClient.GetAdditionalProperty("ConnectionClientId"); @@ -280,7 +278,7 @@ namespace SharedLibraryCore var formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Tell, clientNumber, - $"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{engineMessage}"); + $"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{message}"); if (targetClient.ClientNumber > -1 && message.Length > 0 && targetClient.Level != Data.Models.Client.EFClient.Permission.Console) { @@ -296,13 +294,14 @@ namespace SharedLibraryCore if (targetClient.Level == Data.Models.Client.EFClient.Permission.Console) { Console.ForegroundColor = ConsoleColor.Green; + var cleanMessage = message.FormatMessageForEngine(RconParser.Configuration.ColorCodeMapping) + .StripColors(); using (LogContext.PushProperty("Server", ToString())) { - ServerLogger.LogInformation("Command output received: {Message}", - engineMessage.StripColors()); + ServerLogger.LogInformation("Command output received: {Message}", cleanMessage); } - Console.WriteLine(engineMessage.StripColors()); + Console.WriteLine(cleanMessage); Console.ForegroundColor = ConsoleColor.Gray; } }