Skip to content

Commit

Permalink
V1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NaathySz authored Apr 27, 2024
1 parent 2ed272a commit 2325f26
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions IPAndSiteBlocker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Utils;
using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using System.Text.Json.Serialization;
Expand All @@ -26,14 +27,17 @@ public class SiteAndIPBlockerConfig : BasePluginConfig
[JsonPropertyName("rename_message")]
public string RenameMessage { get; set; } = "{darkred}Your name contains a blocked IP address or website. It will be renamed.";

[JsonPropertyName("admin_immunity")]
public int AdminImmunity { get; set; } = 0;

[JsonPropertyName("ConfigVersion")]
public override int Version { get; set; } = 2;
public override int Version { get; set; } = 3;
}

public class SiteAndIPBlocker : BasePlugin, IPluginConfig<SiteAndIPBlockerConfig>
{
public override string ModuleName => "Site and IP Blocker";
public override string ModuleVersion => "1.1.0";
public override string ModuleVersion => "1.2.0";
public override string ModuleAuthor => "Nathy";
public override string ModuleDescription => "Block sites and IP addresses in chat.";

Expand Down Expand Up @@ -126,6 +130,11 @@ private HookResult OnPlayerChatAll(CCSPlayerController? player, CommandInfo mess
if (player == null || !player.IsValid || player.IsBot || string.IsNullOrEmpty(message.GetArg(1)))
return HookResult.Handled;

if (Config.AdminImmunity == 1 && AdminManager.PlayerHasPermissions(player, "@css/generic"))
{
return HookResult.Continue;
}

string chatMessage = message.GetArg(1);

if (ContainsUrlOrIp(chatMessage))
Expand All @@ -147,6 +156,11 @@ private HookResult OnPlayerChatTeam(CCSPlayerController? player, CommandInfo mes
if (player == null || !player.IsValid || player.IsBot || string.IsNullOrEmpty(message.GetArg(1)))
return HookResult.Handled;

if (Config.AdminImmunity == 1 && AdminManager.PlayerHasPermissions(player, "@css/generic"))
{
return HookResult.Continue;
}

string chatMessage = message.GetArg(1);

if (ContainsUrlOrIp(chatMessage))
Expand Down

0 comments on commit 2325f26

Please sign in to comment.