Paste #9917: Naughty Word Censor V2

Date: 2014/09/21 12:49:02 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


#Violet Server World Scripts v0.111
#By TheGeek007  
#9-21-14  

VioletWorldScript:
    type: world
    events:
#this event fires when the server starts
        on server start:
        # clear the flag, it saves between reboots 
        - flag server naughtywords:!
        #set a server flag with a list of naughty words  
        - flag server naughtywords:|:fuck|shit|damn|pussy|cunt|bitch|nigger|dick|penis| ass 
#to add a naughty word /ex flag server naughtywords:->:word
#to remove a naughty word /ex flag server naughtywords:<-:word

#this event fires every time a player chats, even if they are muted
        on player chats:
        #this line stores a definition that replaces dirty words with *%@&
        - define replacement <context.message.replace[regex:(?i)(<server.flag[naughtywords].as_list.replace[li@]>)].with[*%@&]>
        #compare original message with replacement, returns true if the two are different
        #big thanks to McMonkey for this line!
        - if !<context.message.is[==].to[%replacement%]>
        {
#Isi said he wants to be immune to the infractions. Lets test out name recognition on me and have
#Officer Jenny go batshit crazy on me for lulz. If Isiliden, then Officer Jenny will suck up to him
            - if <player.name> == TheGeek007 then
            {
                #have Officer Jenny kill the Geek over and over
            }

            - if <player.name> == Isiliden then
            {
                #suck up here
            }
            else
            #somebody other than Isi, lay down the law!
            {
            #Increment player.flag[infractions] if a naughty word is detected, with a timeout of 30 min
                - flag player infractions:++ duration:30m
                #- announce "DEBUG <player.name> has <player.flag[infractions]> infractions so far"
                #1 infraction: warn
                - if <player.flag[infractions]> == 1
                {
                    - announce "<green>[Officer Jenny] <white><player.name> This is your <red>FIRST WARNING <white> for language! Curse again and <red>RANDOM MISFORTUNE <white> may befall you!"
                }
                #2 infractions: warn and random misfortune
                - if <player.flag[infractions]> == 2
                {
                    - announce "<green>[Officer Jenny] <white><player.name> This is your <red>SECOND WARNING <white> for language! Curse again and you will be muted for <red>15 minutes!"
                    - random
                    {
                        - run MisfortuneJenny
                        - run MisfortunePikachu
                        - run MisfortuneKoffing
                        - run MisfortuneVoltorb
                    }
                }
                #3 infractions: 15 min mute and random misfortune, add blind and confuse 1 min
                - if <player.flag[infractions]> == 3
                {
                    - announce "<green>Officer Jenny <white> used <yellow>Psyduck Tape<white> on <player.name> for 15 minutes! <red>Its super effective! <white>Curse again and you will be muted for <red>30 minutes!"
                    - execute as_server "mute <player.name> 15m"
                    - potion BLINDNESS duration:60
                    - potion CONFUSION duration:60
                    - random
                    {
                        - run MisfortuneJenny
                        - run MisfortunePikachu
                        - run MisfortuneVoltorb
                        - run MisfortuneKoffing
                    }
                }
                #4 infractions: 30 min mute and random misfortune, blind, confuse, and slow for 2 min
                - if <player.flag[infractions]> == 4
                {
                    - announce "<green>Officer Jenny <white> used <yellow>Psyduck Tape<white> on <player.name> for 30 minutes! <red>Its super effective! <white>Curse again and you will be muted for <red>45 minutes!"
                    - execute as_server "mute <player.name> 30m"
                    - potion BLINDNESS duration:120
                    - potion CONFUSION duration:120
                    - potion SLOW duration:120
                    - random
                    {
                        - run MisfortuneJenny
                        - run MisfortunePikachu
                        - run MisfortuneVoltorb
                        - run MisfortuneKoffing
                    }
                }
                #5 infractions: 45 min mute and random misfortune, blind, confuse, and slow for 3 min
                - if <player.flag[infractions]> == 4
                {
                    - announce "<green>Officer Jenny <white> used <yellow>Psyduck Tape<white> on <player.name> for 45 minutes! <red>Its super effective!"
                    - execute as_server "mute <player.name> 45m"
                    - potion BLINDNESS duration:180
                    - potion CONFUSION duration:180
                    - potion SLOW duration:180
                    - random
                    {
                        - run MisfortuneJenny
                        - run MisfortunePikachu
                        - run MisfortuneVoltorb
                        - run MisfortuneKoffing
                    }
                }
            #Lets set the replacement variable again, this time replacing "lag" with more positive words!
            - random
            {
                - define replacement <context.message.replace[lag].with[I love this server!]>
                - define replacement <context.message.replace[lag].with[This server rocks!]>
                - define replacement <context.message.replace[lag].with[This server is awesome!]>
                - define replacement <context.message.replace[lag].with[This server is the best!]>
                - define replacement <context.message.replace[lag].with[This is my favorite server!]>
            }
            #this line does the actual replacement if curse words were detected
            - determine %replacement%
        }

#Makes players not able to use portals AT ALL!!! (YAY!)  
        on player uses portal:
        - determine CANCELLED

        on portal created:
        - announce "<red>WARNING! Portal creation detected! This is a violation of server rules!"

        on entity enters portal:
        - if <server.flag[nospam]> == null then
        {
            - announce "<red>WARNING Portal activity detected at location <context.location>!"
        }
        - flag server nospam:true duration:5s
        # doesn't work, good try though
        - determine CANCELLED

MisfortuneJenny:
    type: task
    script:
    - narrate "Officer Jenny's Growlithe used Fire Spin on <player.name> for Bad Language!"
    - burn <player> duration:5

MisfortunePikachu:
    type: task
    script:
    - narrate "A passing Pikachu is offended at <player.name>'s language and used Thunder!"
    - strike <player.location>

MisfortuneVoltorb:
    type: task
    script:
    - narrate "A passing Voltorb is offended at <player.name>'s language and used Explosion!"
    - explode power:1 <player.location> fire

MisfortuneKoffing:
    type: task
    script:
    - narrate "A passing Koffing is offended at <player.name>'s language and used Poison Gas!"
    - potion CONFUSION duration:15
    - potion POISON duration:10