I made some minor changes to my copy to be able to catch things like "a s s h o l e" without adding that explicitly to the wordlist. Also enabled the list return but the warning doesn't work regarding the reply to chat not working. Works in console, though.
--- UFilter.cs 2018-08-22 17:06:56.106073200 -0500
+++ UFilter_new.cs 2018-08-23 08:40:23.541029829 -0500
@@ -90,6 +90,9 @@
[JsonProperty(PropertyName = "Allowed profanity")]
public List<string> AllowedProfanity { get; set; } = new List<string>();
+
+ [JsonProperty(PropertyName = "Remove spaces when checking (true/false)")]
+ public bool RemoveSpaces { get; set; } = false;
}
protected override void LoadConfig()
@@ -235,6 +238,10 @@
private string[] Profanities(string text)
{
+ if (config.RemoveSpaces)
+ {
+ text = Regex.Replace(text, @"\s", "");
+ }
return Regex.Split(text, @"\W").Where(w => storedData.Profanities.Contains(w.ToLower()) && !config.AllowedProfanity.Contains(w.ToLower())).ToArray();
}
@@ -309,6 +316,10 @@
return string.Empty;
case "censor":
+ if (config.RemoveSpaces)
+ {
+ text = Regex.Replace(text, @"\s", "");
+ }
foreach (string word in list)
{
text = text.Replace(word, config.CensorText.Length == 1 ? new string(config.CensorText[0], word.Length) : config.CensorText);
@@ -472,9 +483,10 @@
Message(player, "WordRemoved", argList);
break;
- /*case "list":
- Message(player, string.Join(", ", storedData.Profanities.Cast<string>().ToArray());
- break;*/
+ case "list":
+ player.Reply("Word list (if none displayed, use console):");
+ Message(player, string.Join(", ", storedData.Profanities.Cast<string>().ToArray()));
+ break;
default:
Message(player, "CommandUsage", command);