mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-08 22:28:15 -05:00
Refactor the ProfanityDetermentConfiguration class into ProfanityDetermentSettings
The class ProfanityDetermentConfiguration has been renamed to ProfanityDetermentSettings to better reflect its purpose. The unnecessary namespace declaration has been removed, along with the generation method that has been replaced with direct property initializations. Modifications have also been made to reflect these changes in the Plugin class.
This commit is contained in:
parent
7fc2a600c6
commit
c4defacabc
@ -22,9 +22,9 @@ public class Plugin : IPluginV2
|
||||
|
||||
private const string ProfanityKey = "_profanityInfringements";
|
||||
|
||||
private readonly ProfanityDetermentConfiguration _configuration;
|
||||
private readonly ProfanityDetermentSettings _configuration;
|
||||
|
||||
public Plugin(ProfanityDetermentConfiguration configuration)
|
||||
public Plugin(ProfanityDetermentSettings configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
|
||||
@ -44,7 +44,7 @@ public class Plugin : IPluginV2
|
||||
|
||||
public static void RegisterDependencies(IServiceCollection serviceProvider)
|
||||
{
|
||||
serviceProvider.AddConfiguration<ProfanityDetermentConfiguration>("ProfanityDetermentSettings");
|
||||
serviceProvider.AddConfiguration("ProfanityDetermentSettings", new ProfanityDetermentSettings());
|
||||
}
|
||||
|
||||
private Task GameEventSubscriptionsOnClientMessaged(ClientMessageEvent clientEvent, CancellationToken token)
|
||||
|
@ -1,51 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
|
||||
namespace IW4MAdmin.Plugins.ProfanityDeterment
|
||||
{
|
||||
public class ProfanityDetermentConfiguration : IBaseConfiguration
|
||||
{
|
||||
public List<string> OffensiveWords { get; set; } = [];
|
||||
public bool EnableProfanityDeterment { get; set; }
|
||||
public required string ProfanityWarningMessage { get; set; }
|
||||
public required string ProfanityKickMessage { get; set; }
|
||||
public int KickAfterInfringementCount { get; set; }
|
||||
public bool KickOnInfringingName { get; set; } = true;
|
||||
|
||||
public IBaseConfiguration Generate()
|
||||
{
|
||||
OffensiveWords = new List<string>()
|
||||
{
|
||||
@"(ph|f)[a@]g[s\$]?",
|
||||
@"(ph|f)[a@]gg[i1]ng",
|
||||
@"(ph|f)[a@]gg?[o0][t\+][s\$]?",
|
||||
@"(ph|f)[a@]gg[s\$]",
|
||||
@"(ph|f)[e3][l1][l1]?[a@][t\+][i1][o0]",
|
||||
@"(ph|f)u(c|k|ck|q)",
|
||||
@"(ph|f)u(c|k|ck|q)[s\$]?",
|
||||
@"(c|k|ck|q)un[t\+][l1][i1](c|k|ck|q)",
|
||||
@"(c|k|ck|q)un[t\+][l1][i1](c|k|ck|q)[e3]r",
|
||||
@"(c|k|ck|q)un[t\+][l1][i1](c|k|ck|q)[i1]ng",
|
||||
@"b[i1][t\+]ch[s\$]?",
|
||||
@"b[i1][t\+]ch[e3]r[s\$]?",
|
||||
@"b[i1][t\+]ch[e3][s\$]",
|
||||
@"b[i1][t\+]ch[i1]ng?",
|
||||
@"n[i1]gg?[e3]r[s\$]?",
|
||||
@"[s\$]h[i1][t\+][s\$]?",
|
||||
@"[s\$][l1]u[t\+][s\$]?"
|
||||
};
|
||||
|
||||
var loc = Utilities.CurrentLocalization.LocalizationIndex;
|
||||
|
||||
EnableProfanityDeterment = Utilities.PromptBool(loc["PLUGINS_PROFANITY_SETUP_ENABLE"]);
|
||||
ProfanityWarningMessage = loc["PLUGINS_PROFANITY_WARNMSG"];
|
||||
ProfanityKickMessage = loc["PLUGINS_PROFANITY_KICKMSG"];
|
||||
KickAfterInfringementCount = 2;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public string Name() => "ProfanityDetermentSettings";
|
||||
}
|
||||
}
|
40
Plugins/ProfanityDeterment/ProfanityDetermentSettings.cs
Normal file
40
Plugins/ProfanityDeterment/ProfanityDetermentSettings.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
using SharedLibraryCore;
|
||||
|
||||
namespace IW4MAdmin.Plugins.ProfanityDeterment;
|
||||
|
||||
public class ProfanityDetermentSettings
|
||||
{
|
||||
public List<string> OffensiveWords { get; set; } =
|
||||
[
|
||||
@"(ph|f)[a@]g[s\$]?",
|
||||
@"(ph|f)[a@]gg[i1]ng",
|
||||
@"(ph|f)[a@]gg?[o0][t\+][s\$]?",
|
||||
@"(ph|f)[a@]gg[s\$]",
|
||||
@"(ph|f)[e3][l1][l1]?[a@][t\+][i1][o0]",
|
||||
@"(ph|f)u(c|k|ck|q)",
|
||||
@"(ph|f)u(c|k|ck|q)[s\$]?",
|
||||
@"(c|k|ck|q)un[t\+][l1][i1](c|k|ck|q)",
|
||||
@"(c|k|ck|q)un[t\+][l1][i1](c|k|ck|q)[e3]r",
|
||||
@"(c|k|ck|q)un[t\+][l1][i1](c|k|ck|q)[i1]ng",
|
||||
@"b[i1][t\+]ch[s\$]?",
|
||||
@"b[i1][t\+]ch[e3]r[s\$]?",
|
||||
@"b[i1][t\+]ch[e3][s\$]",
|
||||
@"b[i1][t\+]ch[i1]ng?",
|
||||
@"n[i1]gg?[e3]r[s\$]?",
|
||||
@"[s\$]h[i1][t\+][s\$]?",
|
||||
@"[s\$][l1]u[t\+][s\$]?"
|
||||
];
|
||||
|
||||
public bool EnableProfanityDeterment { get; set; } =
|
||||
Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_PROFANITY_SETUP_ENABLE"].PromptBool();
|
||||
|
||||
public string ProfanityWarningMessage { get; set; } =
|
||||
Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_PROFANITY_WARNMSG"];
|
||||
|
||||
public string ProfanityKickMessage { get; set; } =
|
||||
Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_PROFANITY_KICKMSG"];
|
||||
|
||||
public int KickAfterInfringementCount { get; set; } = 2;
|
||||
public bool KickOnInfringingName { get; set; } = true;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user