Merge pull request #20 from cubrr/strip-colors
Remove colors from log output
This commit is contained in:
commit
1dd1da92c2
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user