fancybackup.sk

Created by vLorenzo

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.

#------------------------------------------------------------------------------------------------------------------#
# $$$$$$$$\                                           $$$$$$$\                      $$\                            #
# $$  _____|                                          $$  __$$\                     $$ |                           #
# $$ |   $$$$$$\  $$$$$$$\   $$$$$$$\ $$\   $$\       $$ |  $$ | $$$$$$\   $$$$$$$\ $$ |  $$\ $$\   $$\  $$$$$$\   #
# $$$$$\ \____$$\ $$  __$$\ $$  _____|$$ |  $$ |      $$$$$$$\ | \____$$\ $$  _____|$$ | $$  |$$ |  $$ |$$  __$$\  #
# $$  __|$$$$$$$ |$$ |  $$ |$$ /      $$ |  $$ |      $$  __$$\  $$$$$$$ |$$ /      $$$$$$  / $$ |  $$ |$$ /  $$ | #
# $$ |  $$  __$$ |$$ |  $$ |$$ |      $$ |  $$ |      $$ |  $$ |$$  __$$ |$$ |      $$  _$$<  $$ |  $$ |$$ |  $$ | #
# $$ |  \$$$$$$$ |$$ |  $$ |\$$$$$$$\ \$$$$$$$ |      $$$$$$$  |\$$$$$$$ |\$$$$$$$\ $$ | \$$\ \$$$$$$  |$$$$$$$  | #
# \__|   \_______|\__|  \__| \_______| \____$$ |      \_______/  \_______| \_______|\__|  \__| \______/ $$  ____/  # 
#                                     $$\   $$ |                                                        $$ |       #
#                                     \$$$$$$  |                                                        $$ |       #
#                                      \______/                                                         \__|       #
#------------------------------------------------------------------------------------------------------------------#
# AUTHOR: vLorenzo
# VERSION: 1.0
#------------------------------------------------------------------------------------------------------------------#

on quit:
	set {fancybackupinventory::%player's uuid%::*} to items in player's inventory
	log "[LOG] %player% it went off the server so we saved its inventory which contained: %{fancybackupinventory::%player's uuid%::*}% for protection" to "fancybackup.log"
	
on death:
	if victim is a player:
		set {fancybackupinventory::%victim's uuid%::*} to items in victim's inventory
		log "[LOG] %victim% died, so we backed up his inventory with contained: %{fancybackupinventory::%victim's uuid%::*}%" to "fancybackup.log"
		
command /fancybackup [<text>] [<text>]:
	trigger:
		if player has permission "fancybackup.admin":
			if arg-1 is "backup":
				if arg-2 is set:
					set {_arg2} to arg-2 parsed as player
					set {_uuidarg2} to {_arg2}'s uuid
					if {fancybackupinventory::%{_uuidarg2}%::*} is set:
						wait a tick
						drop {fancybackupinventory::%{_uuidarg2}%::*} at player's location
						wait a tick
						send title "&a&lBackup ✓" with subtitle "&a%arg-2%'s &7inventory has been restored"
						wait a tick
						log "[STAFF] %player% requested a backup of %arg-2% inventory, so we backed up his inventory wich contained: %{fancybackupinventory::%{_uuidarg2}%::*}%" to "fancybackup.log"
					else:
						send title "&c&lBackup ✗" with subtitle "&7Sorry The &e%arg-2% &7inventory does not exist"
						message ""
						message "&cFancyBackup"
						message "&7Try checking the logs to get a better comparison"
						message ""
				else:
					message ""
					message "&cFancyBackup"
					message "&7You have to specify a text otherwise I can't check if backup exists, try &7/fancybackup backup <player>"
					message ""
			else:
				message ""
				message "&aFancyBackup"
				message "&7/fancybackup backup <player>"
				message ""
		else:
			message "&cYou don't have permission to do this, if you think it's a mistake contact an administrator"