guimaker.sk

Created by CorruptedVeit

Other available versions. Ordered by newest to oldest versions:

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:
	prefix: &8[&6GUI&8]
	permission: skript.guimaker
	no-permission: &cYou don't have the correct permissions to create a gui.
	filepath: plugins/Skript/scripts
#---------------------------------------------------------------------------------------------
command /guimaker [<text>] [<integer>]:
	trigger:
		if player has permission "skript.guimaker":
			if {gui::creation::%player%::*} is not set:
				if arg-1 is not set:
					send "{@prefix} &cYou have to specify a script where the gui will be saved later."
					stop
				if arg-2 is not set:
					send "{@prefix} &cYou have to specify the amount of rows in the gui."
					stop
				if arg-2 is not 1, 2, 3, 4, 5 or 6:
					send "{@prefix} &cYou only can create a gui from 1 to 6 rows."
					stop
				send "{@prefix} &7Creating a gui with guimaker.. /guimaker to close guimaker."
				send "{@prefix} &7Now click on the items that you want in your gui."
				send "{@prefix} &cThe item will be in the same position like the clicked one."
				if last 3 characters of arg-1 is ".sk":
					set {_name} to arg-1
				else:
					set {_name} to "%arg-1%.sk"
				set {gui::creation::%player%::name} to {_name}
				set {gui::creation::%player%::rows} to arg-2
				add "set {_gui} to chest inventory with %{gui::creation::%player%::rows}% rows named ""GUI-Maker by CorruptedVeit""" to {temp::guimaker::%player%::*}
			else:
				if number of {temp::guimaker::%player%::*} is not higher than 1:
					delete {gui::creation::%player%::*}
					delete {temp::guimaker::%player%::*}
					send "{@prefix} &7Closing guimaker.."
				else:
					if file "{@filepath}/%{gui::creation::%player%::name}%" exists:
						send "{@prefix} &7Writing down specified gui in '&6%{gui::creation::%player%::name}%&7'"
						set {_line} to 1 + line count of file "{@filepath}/%{gui::creation::%player%::name}%"
					else:
						send "{@prefix} &7Creating script '&6%{gui::creation::%player%::name}%&7' with specified gui."
						create file "{@filepath}/%{gui::creation::%player%::name}%"
						set {_line} to 0
					wait 1 seconds
					add 1 to {_line}
					if {temp::guimaker-heads::%player%::*} is set:
						write "options:" at line {_line} to file "{@filepath}/%{gui::creation::%player%::name}%"
						add 1 to {_line}
						loop {temp::guimaker-heads::%player%::*}:
							write "	%loop-value%" at line {_line} to file "{@filepath}/%{gui::creation::%player%::name}%"
							add 1 to {_line}
					wait 1 seconds
					loop {temp::guimaker::%player%::*}:
						set {_text} to loop-value
						replace "{ATnbt" with "{@nbt" in {_text}
						replace "§c and" with " and" in {_text}
						replace "§c, """ with ", """ in {_text}
						write "%{_text}%" at line {_line} to file "{@filepath}/%{gui::creation::%player%::name}%"
						add 1 to {_line}
					write "open {_gui} to player" at line {_line} to file "{@filepath}/%{gui::creation::%player%::name}%"
					wait 0.5 seconds
					send "{@prefix} &aSuccessfully created a gui with %number of {temp::guimaker::%player%::*}% &aitems."
					send "{@prefix} &aYou can now integrate it and edit it freely :)"
					send "{@prefix} &7Closing guimaker.."
					delete {gui::creation::%player%::*}
					delete {temp::guimaker::%player%::*}
					delete {temp::guimaker-heads::%player%::*}

		else:
			send "{@prefix} {@no-permission}"

on inventory click:
	if {gui::creation::%player%::*} is set:
		cancel event
		if clicked slot is not -999:
			set {_name} to name of clicked item
			set {_clicked} to clicked item with no nbt
			set name of {_clicked} to ""
			if clicked item is player head item:
				if nbt of clicked item is set:
					set {_nbt} to nbt of clicked item
					replace all """" with """""" in {_nbt}
					add "nbt-slot.%clicked slot%: ""%{_nbt}%""" to {temp::guimaker-heads::%player%::*}
					set {_clicked} to "%{_clicked}% with nbt {ATnbt-slot.%clicked slot%}"
			if lore of clicked item is set:
				set {_lore::*} to lore of clicked item
				loop {_lore::*}:
					add """%loop-value%""" to {_lore-1::*}
			if name of clicked item is set:
				if lore of clicked item is set:
					add "set slot %clicked slot% of {_gui} to %{_clicked}% named ""%{_name}%"" with lore %{_lore-1::*}%" to {temp::guimaker::%player%::*}
				else:
					add "set slot %clicked slot% of {_gui} to %{_clicked}% named ""%{_name}%""" to {temp::guimaker::%player%::*}
			else:
				if lore of clicked item is set:
					add "set slot %clicked slot% of {_gui} to %{_clicked}% named """" with lore %{_lore-1::*}%" to {temp::guimaker::%player%::*}
				else:
					add "set slot %clicked slot% of {_gui} to %{_clicked}%" to {temp::guimaker::%player%::*}
			send "{@prefix} &aSuccessfully added clicked item to gui."
			play sound "BLOCK_NOTE_BLOCK_PLING" with volume 0.9 to player

on disconnect:
	if {gui::creation::%player%::*} is set:
		delete {gui::creation::%player%::*}
		delete {temp::guimaker::%player%::*}
		delete {temp::guimaker-heads::%player%::*}