ReportsGUI-Release.sk

Created by MattyHD0

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[&cReportsGUI&8] &7
	version: Alpha-1.0 #Don't change this, it's for the updater

	gui.reports: &8Reports
	gui.namePrefix: &e
	gui.reportedBy: &7Reported by: &c
	gui.reason: &7Reason: &c
	gui.date: &7Date: &c
	gui.lClick: &7Left-click to teleport
	gui.rClick: &7Right-click to delete

	msg.playerReport: &7You reported &c%{_r}% &7for &c%{_t}%
	msg.playerReported: &c%{_p}% &7reported &c%{_r}% &7for the reason &c%{_t}%

	msg.unknownReason: &7You have to assign a reason to the report
	msg.unknownPlayer: &7You have to choose the user you want to report
	msg.offlinePlayer: &7That player is not online
	msg.teleportSuccessfully: &7You were teleported up to &c%{_r}%
	msg.openInterface: &7You opened the reporting interface

	msg.noPermissions: &cYou don't have permission to do that!
	msg.reportsDeleted: &7All reports were removed!

	msg.reloadingScript: &7Reloading script...
	msg.reloadedScript: &7&7Script reloaded (debug in the console)!

	help.commandList: &7Command list >
	help.clear: &7Clear the list of reports
	help.reload: &7Reload the script

command /report [<player>] [<text>]:
	permission message: {@msg.noPermissions}
	permission: reportsgui.report
	trigger:
		if arg-1 is online:
			if arg-1 is set:
				if arg-2 is set:
					createReport(player, arg-1, arg-2)
				else:
					send "{@prefix}{@msg.unknownReason}"
			else:
				send "{@prefix}{@msg.unknownPlayer}"
		else:
			send "{@prefix}{@msg.offlinePlayer}"

command /reports:
	permission message: {@msg.noPermissions}
	permission: reportsgui.list
	trigger:
		reportsGui(player)
		send "{@prefix}{@msg.openInterface}"

command /reportsgui [<text>] [<text>]:
	permission message: {@msg.noPermissions}
	permission: reportsgui.admin
	trigger:
		if arg-1 is not set:
			send "{@prefix}{@help.commandList}"
			send "&7> /reportsgui clear - {@help.clear}"
			send "&7> /reportsgui reload - {@help.reload}"
		else if arg-1 is "clear":
			delete {reportsGui.report::*}
			send "{@prefix}{@msg.reportsDeleted}"
		else if arg-1 is "reload":
			send "{@prefix}{@msg.reloadingScript}"
			execute console command "sk reload %script%"
			send "{@prefix}{@msg.reloadedScript}"

function createReport(p: player, r: player, t: text):
	add  skull of {_r} named "{@gui.namePrefix}%{_r}%" with lore "{@gui.reportedBy}%{_p}%", "{@gui.reason}%{_t}%", "{@gui.date}%now%", "", "{@gui.lClick}" and "{@gui.rClick}" to {reportsGui.report::*}
	send "{@prefix}{@msg.playerReport}" to {_p}
	loop all players:
		send "{@prefix}{@msg.playerReported}" to loop-player if the loop-player has permission "reportsgui.notify"

function reportsGui(p: player):
	open virtual chest inventory with 6 rows named "{@gui.reports}" to {_p}
	play sound "ENTITY_CHICKEN_EGG" with volume 1 to {_p}
	set {_s} to 0
	loop {reportsGui.report::*}:
		set {_reported} to name of {reportsGui.report::%loop-index%}
		replace every "{@gui.namePrefix}" with "" in {_reported}
		set {_reported} to {_reported} parsed as player
		make gui slot {_s} of {_p} with {reportsGui.report::%loop-index%} to run function teleport({_p}, {_reported}) using left mouse button
		make gui slot {_s} of {_p} with {reportsGui.report::%loop-index%} to run function deleteReport({_p}, loop-index) using right mouse button
		add 1 to {_s}

function teleport(p: player, r: player):
	if {_r} is online:
		teleport {_p} to {_r}
		play sound "ENTITY_ENDERMAN_TELEPORT" at volume 1 to {_p}
		send "{@prefix}{@msg.teleportSuccessfully}" to {_p}
	else:
		send "{@prefix}{@msg.offlinePlayer}" to {_p}

function deleteReport(p: player, id: string):
	play sound "BLOCK_ANVIL_PLACE" at volume 0.5 to {_p}
	delete {reportsGui.report::%{_id}%}
	reportsGui({_p})