chatutils.sk

Created by CyrotechV2

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.

# Saw someone do this so I thought ill make one but better
# Made by Cerial

variables:
	{muteChat} = false

command /mutechat:
	permission: cerial.mutechat.cmd
	trigger:
		if {muteChat} = false:
			set {muteChat} to true
			send "&eChat has been muted by %player%. Only people with the bypass permission can talk." to all players
			stop
		
		else:
			set {muteChat} to false
			send "&eChat has been unmuted by %player%. Everyone can talk on the server." to all players
			stop

on chat:
	if {muteChat} = true:
		if player has permission "cerial.mutechat.bypass":
			stop
		
		else:
			cancel event
			send "&cChat is currently muted! Only players with the bypass permission can talk!"
			stop
	
	else:
		stop

command /clearchat:
	permission: cerial.clearchat.cmd
	trigger:
		loop all players:
			if loop-player doesn't have permission "cerial.clearchat.bypass":
				set {_p::*} to loop-players
		
		loop 1000 times:
			send " " to {_p::*}
		send "&aChat has been cleared by %player%!"
		stop

# I am using multiple permissions for arguments, don't comment to use permission before trigger
command /filter [<text>] [<text>]:
	trigger:
		if player has permission "cerial.filter.help":
			if arg 1 = "help":
				send "&aFilter help"
				send "&8&m                              "
				send "&9- &b/filter help &8| &7&oShows this message."
				send "&9- &b/filter addword <word> &8| &7&oAdds a word to the filter."
				send "&9- &b/filter removeword <word> &8| &7&oRemoves a word from the filter."
				send "&9- &b/filter list &8| &7&oShows all filtered words."
				send "&8&m                              "
			
		if player has permission "cerial.filter.addword":
			if arg 1 = "addword":
				if arg 2 is set:
					if {filter::*} doesn't contain arg 2:
						add arg 2 to {filter::*}
						send "&aAdded %arg 2% to the chat filter."
						stop
					
					else:
						send "&c%arg 2% is already in the filter."
						stop
				
				else:
					send "&cYou need to set a word to add to the filter."
					stop
		
		if player has permission "cerial.filter.removeword":
			if arg 1 = "removeword":
				if arg 2 is set:
					if {filter::*} contains arg 2:
						remove arg 2 from {filter::*}
						send "&aRemoved %arg 2% from the chat filter."
						stop
					
					else:
						send "&c%arg 2% doesn't exist in the filter."
						stop 
				
				else:
					send "&cYou need to set a word to remove from the filter."
					stop
		
		if player has permission "cerial.filter.list":
			if arg 1 = "list":
				send "&eFiltered words:"
				send "&b%{filter::*}%"

on chat:
	if player doesn't have permission "cerial.filter.bypass":
		if message contains {filter::*}:
			cancel event
			send "&c%message% is a filtered message! Please refrain from saying it!"
			stop
		
		else:
			stop
	
	else:
		stop