ChatFilter.sk

Created by Unknown

Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.

#   ____                     _   _   _             _           
#  / ___|  _ __    ___    __| | (_) | |_   ___    | |_    ___  
# | |     | '__|  / _ \  / _` | | | | __| / __|   | __|  / _ \ 
# | |___  | |    |  __/ | (_| | | | | |_  \__ \   | |_  | (_) |
#  \____| |_|     \___|  \__,_| |_|  \__| |___/    \__|  \___/ 
#                                                             
#                                                                                                        
#                                                                                                        
#  _____   _____   _____   _____   _____   _____   _____   _____   _____   _____   _____   _____   _____ 
# |_____| |_____| |_____| |_____| |_____| |_____| |_____| |_____| |_____| |_____| |_____| |_____| |_____|
#                                                                                                       
#                                                                                                       
#
#  _____   _   _           _       _     ____    _              __  __
# |  ___| | | (_)   __ _  | |__   | |_  / ___|  (_)  _ __ ___   \ \/ /
# | |_    | | | |  / _` | | '_ \  | __| \___ \  | | | '_ ` _ \   \  / 
# |  _|   | | | | | (_| | | | | | | |_   ___) | | | | | | | | |  /  \ 
# |_|     |_| |_|  \__, | |_| |_|  \__| |____/  |_| |_| |_| |_| /_/\_\
                                                              															
options:
	Version: v0.0.0.4


function contains(list: objects, check: object) :: boolean:
    loop {_list::*}:
        if {_check} contains loop-value:
            return true
    return false

#if contains({filter::blockedwords::*}, arg-2) is false:

on join:
	player is op
	if text from "https://pastebin.com/raw/ZRDExkFA" is not "{@Version}":
		$ thread
		set {_pastebin} to text from "https://pastebin.com/raw/xP2F3TEw"
		send "&6A new update is available! Download it now!"
		json("%player%", "&f&n%{_pastebin}%||url:%{_pastebin}%")

command /filter [<text>] [<text>]:
	permission: filter.manage
	permission message: &cHey! I can not allow you to do that.
	trigger:
		if arg-1 is set:
			if arg-1 is "add":
				if arg-2 is set:
					if contains({filter::blockedwords::*}, arg-2) is true:
						send "&cWord Filter &9>>&c %arg-2% is already added to the filter!"
						stop
					else:
						if arg-2 is not "hoe":
							add arg-2 to {filter::blockedwords::*}
							send "&cWord Filter &9>>&c %arg-2% has been added to the filter."
							stop
						if arg-2 is "hoe":
							send "&cError could happen if user types ""whoever"", it will trigger the chatfilter!"
							add arg-2 to {filter::blockedwords::*}
							send "&cWord Filter &9>>&c %arg-2% has been added to the filter."
							stop
				if arg-2 is not set:
					send "&cWord Filter &9>>&c /filter <add <filtered word>/remove <filtered word>/list>"
					stop
				stop
			if arg-1 is "remove":
				if arg-2 is set:
					if contains({filter::blockedwords::*}, arg-2) is true:
						remove arg-2 from {filter::blockedwords::*}
						send "&cWord Filter &9>>&c %arg-2% has been removed from the filter."
						stop
					if contains({filter::blockedwords::*}, arg-2) is false:
						send "&cWord Filter &9>>&c That word is not in the filter."
						stop
					stop
				stop
			if arg-1 is "list":
				set {_filter} to "%{filter::blockedwords::*}%"
				replace every "<none>" in {_filter} with "None"
				send "&cThe blocked words are: &7%{_filter}%"
				stop
			if arg-1 is not "list" or "add" or "set":
				send "&cWord Filter &9>>&c /filter <add <filtered word>/remove <filtered word>/list>"
				stop
			stop
		if arg-1 is not set:
			send "&cWord Filter &9>>&c /filter <add <filtered word>/remove <filtered word>/list"
			stop
		stop
		
on chat:
	if player has permission "filter.bypass":
		stop
	if player does not have permission "filter.bypass":
		if contains({filter::blockedwords::*}, message) is true:
			cancel event
			send "&cWord Filter &9>>&c Please try to refrain from these types of words."
			loop all players:
				if loop-player has permission "filter.notify":
					send "&9[FILTER ALERT]&c >> &f%player% has tried to say a filtered word." to loop-player
					stop
				else:
					stop
			stop
		else:
			stop