Skip to content

Commit

Permalink
1.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
oqyh authored Aug 12, 2024
1 parent 1eb58cc commit b086d85
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Chat-Logger-GoldKingZ.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Config/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions Config/EventPlayerChat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down
10 changes: 9 additions & 1 deletion Config/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,22 @@ 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()))
{
return true;
}
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;
Expand Down

0 comments on commit b086d85

Please sign in to comment.