Merge pull request #20 from cubrr/strip-colors

Remove colors from log output
This commit is contained in:
Drew DeVault 2015-02-06 12:25:41 -07:00
commit 1dd1da92c2
2 changed files with 16 additions and 1 deletions

View File

@ -23,5 +23,20 @@ namespace TrueCraft.API
public const string Pink = "§d";
public const string Yellow = "§e";
public const string White = "§f";
public static string RemoveColors(string text)
{
var sb = new StringBuilder(text.Length);
for (int i = 0; i < text.Length; i++)
{
if (text[i] == '§')
{
i++;
continue;
}
sb.Append(text[i]);
}
return sb.ToString();
}
}
}

View File

@ -177,7 +177,7 @@ namespace TrueCraft
var compiled = string.Format(message, parameters);
foreach (var client in Clients)
client.SendMessage(compiled);
Log(LogCategory.Notice, compiled);
Log(LogCategory.Notice, ChatColor.RemoveColors(compiled));
}
protected internal void OnChatMessageReceived(ChatMessageEventArgs e)