mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Allow custom profanity filter replacement
This commit is contained in:
parent
800fe69e5f
commit
201fc8a927
@ -50,13 +50,18 @@ namespace MCGalaxy {
|
||||
}
|
||||
if (!isFiltered) continue;
|
||||
|
||||
// If a bad word is found anywhere in the word, replace the word
|
||||
int length = words[i].Length;
|
||||
words[i] = "&c[&fBlocked&c]&f";
|
||||
// If a bad word is found anywhere in the word, replace the word
|
||||
words[i] = Replace(words[i]);
|
||||
}
|
||||
return String.Join(" ", words);
|
||||
}
|
||||
|
||||
static string Replace(string word) {
|
||||
string replacement = Server.Config.ProfanityReplacement;
|
||||
// for * repeat to ****
|
||||
return replacement.Length == 1 ? new string(replacement[0], word.Length) : replacement;
|
||||
}
|
||||
|
||||
static void InitReduceTable() {
|
||||
if (reduceKeys != null) return;
|
||||
// Because some letters are similar (Like i and l), they are reduced to the same form.
|
||||
|
@ -201,6 +201,8 @@ namespace MCGalaxy {
|
||||
internal List<string> DisabledChatTokens = new List<string>();
|
||||
[ConfigBool("profanity-filter", "Other", false)]
|
||||
public bool ProfanityFiltering = false;
|
||||
[ConfigString("profanity-replacement", "Other", "*")]
|
||||
public string ProfanityReplacement = "*";
|
||||
[ConfigString("host-state", "Other", "Alive")]
|
||||
public string ConsoleName = "Alive";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user