From b086d8526ae095aa3d9a4a4d15db9cb9ef8a32c8 Mon Sep 17 00:00:00 2001 From: Gold KingZ <48490385+oqyh@users.noreply.github.com> Date: Tue, 13 Aug 2024 02:02:35 +0400 Subject: [PATCH] 1.0.9 --- Chat-Logger-GoldKingZ.cs | 2 +- Config/Configs.cs | 2 +- Config/EventPlayerChat.cs | 4 ++-- Config/Helper.cs | 10 +++++++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Chat-Logger-GoldKingZ.cs b/Chat-Logger-GoldKingZ.cs index 9a31141..9adbe4e 100644 --- a/Chat-Logger-GoldKingZ.cs +++ b/Chat-Logger-GoldKingZ.cs @@ -7,7 +7,7 @@ namespace Chat_Logger_GoldKingZ; public class ChatLoggerGoldKingZ : BasePlugin { public override string ModuleName => "Chat Logger (Log Chat To Text Or Discord WebHook)"; - public override string ModuleVersion => "1.0.8"; + public override string ModuleVersion => "1.0.9"; public override string ModuleAuthor => "Gold KingZ"; public override string ModuleDescription => "https://github.com/oqyh"; private readonly PlayerChat _PlayerChat = new(); diff --git a/Config/Configs.cs b/Config/Configs.cs index 3dcc577..4c54e0d 100644 --- a/Config/Configs.cs +++ b/Config/Configs.cs @@ -148,7 +148,7 @@ public string Discord_SideColor public ConfigData() { empty = "---------------------------------vvv [ Text Local Save In (Chat-Logger-GoldKingZ/logs/) ] vvv---------------------------------"; - Text_EnableLoggingMessages = false; + Text_EnableLoggingMessages = true; Text_PrivateTeamMessagesOnly = false; Text_IncludeFlagsMessagesOnly = ""; Text_ExcludeFlagsMessages = "@css/exclude,#css/exclude"; diff --git a/Config/EventPlayerChat.cs b/Config/EventPlayerChat.cs index 3cbf59d..c9b3cea 100644 --- a/Config/EventPlayerChat.cs +++ b/Config/EventPlayerChat.cs @@ -74,7 +74,7 @@ public HookResult OnPlayerChat(CCSPlayerController? player, CommandInfo info, bo string chatteam = Globals.TeamChat[playerid] ? "[TEAM]" : "[ALL]"; if (Globals.TextExclude.ContainsKey(playerid))return HookResult.Continue; if (Globals.TextIncude.ContainsKey(playerid))return HookResult.Continue; - if(!string.IsNullOrEmpty(Configs.GetConfigData().Text_ExcludeMessageContains) && Helper.IsStringValid(message)) return HookResult.Continue; + if(!string.IsNullOrEmpty(Configs.GetConfigData().Text_ExcludeMessageContains) && Helper.Text_IsStringValid(message)) return HookResult.Continue; if (Configs.GetConfigData().Text_ExcludeMessageContainsLessThanXLetters > 0 && Helper.CountLetters(message) <= Configs.GetConfigData().Text_ExcludeMessageContainsLessThanXLetters) return HookResult.Continue; if(Configs.GetConfigData().Text_ExcludeMessageDuplicate && Globals.Client_Text2[playerid] == Globals.Client_Text1[playerid]) return HookResult.Continue; string Time = DateTime.Now.ToString(Configs.GetConfigData().Text_TimeFormat); @@ -122,7 +122,7 @@ public HookResult OnPlayerChat(CCSPlayerController? player, CommandInfo info, bo string chatteam = Globals.TeamChat[playerid] ? "[TEAM]" : "[ALL]"; if (Globals.DiscordExclude.ContainsKey(playerid))return HookResult.Continue; if (Globals.DiscordIncude.ContainsKey(playerid))return HookResult.Continue; - if(!string.IsNullOrEmpty(Configs.GetConfigData().Discord_ExcludeMessageContains) && Helper.IsStringValid(message)) return HookResult.Continue; + if(!string.IsNullOrEmpty(Configs.GetConfigData().Discord_ExcludeMessageContains) && Helper.Discord_IsStringValid(message)) return HookResult.Continue; if (Configs.GetConfigData().Discord_ExcludeMessageContainsLessThanXLetters > 0 && Helper.CountLetters(message) <= Configs.GetConfigData().Discord_ExcludeMessageContainsLessThanXLetters) return HookResult.Continue; if(Configs.GetConfigData().Discord_ExcludeMessageDuplicate && Globals.Client_Text2[playerid] == Globals.Client_Text1[playerid]) return HookResult.Continue; diff --git a/Config/Helper.cs b/Config/Helper.cs index 8799e5b..a43988f 100644 --- a/Config/Helper.cs +++ b/Config/Helper.cs @@ -76,7 +76,7 @@ public static bool IsPlayerInGroupPermission(CCSPlayerController player, string } return false; } - public static bool IsStringValid(string input) + public static bool Text_IsStringValid(string input) { if (!string.IsNullOrEmpty(input) && !input.Contains(" ") && input.Any(c => Configs.GetConfigData().Text_ExcludeMessageContains.Contains(c)) && !char.IsWhiteSpace(input.Last())) { @@ -84,6 +84,14 @@ public static bool IsStringValid(string input) } return false; } + public static bool Discord_IsStringValid(string input) + { + if (!string.IsNullOrEmpty(input) && !input.Contains(" ") && input.Any(c => Configs.GetConfigData().Discord_ExcludeMessageContains.Contains(c)) && !char.IsWhiteSpace(input.Last())) + { + return true; + } + return false; + } public static int CountLetters(string input) { int count = 0;