Shortcuts.sk

Created by AlexLew

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.

#   _____ _                _             _       
#  / ____| |              | |           | |      
# | (___ | |__   ___  _ __| |_ ___ _   _| |_ ___ 
#  \___ \| '_ \ / _ \| '__| __/ __| | | | __/ __|
#  ____) | | | | (_) | |  | || (__| |_| | |_\__ \
# |_____/|_| |_|\___/|_|   \__\___|\__,_|\__|___/

#============== By AlexLew ==============          
                                            
options:
	version : 1.0

on load:
	if {shortcut::firsttime} is not set:
		if file "plugins/Skript/Shortcuts/Example.yml" doesn't exist:
			load yaml "plugins/Skript/Shortcuts/Example.yml" as "plugins/Skript/Shortcuts/Example.yml"
			set skript-yaml value "Shortcuts.1.keywords" from "plugins/Skript/Shortcuts/Example.yml" to "shortcut:testit!"
			set skript-yaml value "Shortcuts.1.change_with" from "plugins/Skript/Shortcuts/Example.yml" to "You tested it!"
			save yaml "plugins/Skript/Shortcuts/Example.yml"
			set {shortcut::firsttime} to false
	set {_shortcuts::*} to files in dir "plugins/Skript/Shortcuts"
	loop {_shortcuts::*}:
		unload yaml "plugins/Skript/Shortcuts/%name of file loop-value%.yml"
		load yaml "plugins/Skript/Shortcuts/%name of file loop-value%.yml" as "plugins/Skript/Shortcuts/%name of file loop-value%.yml"

	#============ Create dom ============
	if dir "plugins/Skript/scripts/ShortcutsDom" doesn't exist:
		create dir "plugins/Skript/scripts/ShortcutsDom"
	else:
		set {_dir::*} to files in dir "plugins/Skript/scripts/ShortcutsDom"
		set {_shortcuts::*} to files in dir "plugins/Skript/Shortcuts"

		#============ Check changes ============
		loop {_dir::*}:
			set {_lines} to line count of file loop-value
			loop {_lines} times:
				loop {_shortcuts::*}:
					set {_k::*} to skript-yaml node list "Shortcuts" from "plugins/Skript/Shortcuts/%name of file loop-value-3%.yml"
					loop {_k::*}:

						#============ Editor ============
						if line loop-value-2 in file loop-value-1 contains skript-yaml value "%loop-value-4%.keywords" from "plugins/Skript/Shortcuts/%name of file loop-value-3%.yml":
							set {_replace} to skript-yaml value "%loop-value-4%.change_with" from "plugins/Skript/Shortcuts/%name of file loop-value-3%.yml"
							loop 1 times:
								set {_tabs::*} to {_replace} parsed as "%string% \%tab\%*%integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tab\% * %integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tab\%* %integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tab\% *%integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tab\% * %integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tab\%* %integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tab\% *%integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tab\%*%integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tab\% * %integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tab\%* %integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tab\% *%integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tab\%*%integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tab\% * %integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tab\%* %integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tab\% *%integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tab\%*%integer%%string%"
							loop 1 times:
								set {_tabs::*} to {_replace} parsed as "%string% \%tabulation\%*%integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tabulation\% * %integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tabulation\%* %integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tabulation\% *%integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tabulation\% * %integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tabulation\%* %integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tabulation\% *%integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tabulation\%*%integer% %string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tabulation\% * %integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tabulation\%* %integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tabulation\% *%integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string% \%tabulation\%*%integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tabulation\% * %integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tabulation\%* %integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tabulation\% *%integer%%string%"
								{_tabs::*} is not set
								set {_tabs::*} to {_replace} parsed as "%string%\%tabulation\%*%integer%%string%"
							loop 1 times:
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%nl\% * %integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%nl\%* %integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%nl\% *%integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%nl\%*%integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%nl\% * %integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%nl\%* %integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%nl\% *%integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%nl\%*%integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%nl\% * %integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%nl\%* %integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%nl\% *%integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%nl\%*%integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%nl\% * %integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%nl\%* %integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%nl\% *%integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%nl\%*%integer%%string%"
							loop 1 times:
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%new line\% * %integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%new line\%* %integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%new line\% *%integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%new line\%*%integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%new line\% * %integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%new line\%* %integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%new line\% *%integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%new line\%*%integer% %string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%new line\% * %integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%new line\%* %integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%new line\% *%integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string% \%new line\%*%integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%new line\% * %integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%new line\%* %integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%new line\% *%integer%%string%"
								{_nl::*} is not set
								set {_nl::*} to {_replace} parsed as "%string%\%new line\%*%integer%%string%"
							set {_tab} to "	"
							set {_nl} to nl
							if {_tabs::*} is set:	
								loop {_tabs::2} times:
									set {_tab} to "%{_tab}%	"
							if {_nl::*} is set:	
								loop {_nl::2} times:
									set {_nl} to "%{_nl}%%nl%"
							replace all "%%tab%%" with {_tab} in {_replace}
							replace all "%%tabulation%%" with {_tab} in {_replace}
							replace all "%%nl%%" with {_nl} in {_replace}
							replace all "%%new line%%" with {_nl} in {_replace}
							replace all skript-yaml value "%loop-value-4%.keywords" from "plugins/Skript/Shortcuts/%name of file loop-value-3%.yml" with {_replace} in line loop-value-2 in file loop-value-1
			set {_extension::*} to loop-value split at name of file loop-value
			if {_extension::2} is ".sk":
				execute console command "/sk reload ShortcutsDom/%name of file loop-value%"


command /shortcut <text> [<text>]:
	usage: &cUse &e/shortcut help &cfor more informations
	trigger:
		if arg-1 is "help":
			if sender is console:
				send "&d========== &fShortcut &d==========" to console
				send "&eShortcut, a script for make shortcuts easly!" to console
				send "&dVersion &f{@version}" to console
				send "&dAuthor: &fAlexLew" to console
			else:
				send "&d========== &fShortcut &d=========="
				send "&eShortcut, a script for make shortcuts easly!"
				send "&dVersion &f{@version}"
				send "&dAuthor: &fAlexLew"
		else:
			if sender is console:
				send "&cUse &e/shortcut help &cfor more informations" to console
			else:
				send "&cUse &e/shortcut help &cfor more informations"