AntiAdvert

Approved AntiAdvert 1.1a

No permission to download

Sturt

Plugin Developer
Plugin Developer
Jan 4, 2015
71
38
8
45
So when I tested it I had no problem writing in the ip or domain, as a normal player. Is it supposed to detect ports added to servers? like a name as a ip followed by the domain? ex. exampleserver:28015?
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,066
4,441
113
At your house.
github.com
So when I tested it I had no problem writing in the ip or domain, as a normal player. Is it supposed to detect ports added to servers? like a name as a ip followed by the domain? ex. exampleserver:28015?
I'm pretty sure domains should be removed, idk if it works with ports, but i will test it.
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,066
4,441
113
At your house.
github.com
Testable 1.1:

Python:
__author__ = 'DreTaX'
__version__ = '1.1'
import clr

clr.AddReferenceByPartialName("Fougerite")
import Fougerite
import re

whitelist = ["equinoxgamers.com", "dretaxmc.eu"]


class AntiAdvert:

    def On_Chat(self, Player, ChatEvent):
        if Player.Admin or Player.Moderator:
            return
        Text = ChatEvent.OriginalMessage.lower()
        Text = re.sub(r'[0-9]+(?:\.[0-9]+){3}(:[0-9]+)?', '', Text)
        a = re.findall(r'([\.a-z]*\.)(com|en|org|de|ro|ru|hu|eu|net)(:[0-9]+)', Text)
        for x in a:
            n = str.join('', x)
            if n not in whitelist:
                Text = Text.replace(n, '')
        if ChatEvent.OriginalMessage.lower() != Text:
            Plugin.Log("Test", "- " + Player.Name + " : " + ChatEvent.OriginalMessage.lower())
            Player.Message("Please do not advertise!")
        ChatEvent.NewText = Text