RealKeys 1.3.sk

Created by JustIlas

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:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
#      ██▀███  ▓█████ ▄▄▄       ██▓     ██ ▄█▀▓█████▓██   ██▓  ██████ 
#     ▓██ ▒ ██▒▓█   ▀▒████▄    ▓██▒     ██▄█▒ ▓█   ▀ ▒██  ██▒▒██    ▒ 
#     ▓██ ░▄█ ▒▒███  ▒██  ▀█▄  ▒██░    ▓███▄░ ▒███    ▒██ ██░░ ▓██▄    | Version: 1.3
#    ▒██▀▀█▄  ▒▓█  ▄░██▄▄▄▄██ ▒██░    ▓██ █▄ ▒▓█  ▄  ░ ▐██▓░  ▒   ██▒  |  * Updated on 08/05/2020
#    ░██▓ ▒██▒░▒████▒▓█   ▓██▒░██████▒▒██▒ █▄░▒████▒ ░ ██▒▓░▒██████▒▒                  MM/DD/YYYY
#    ░ ▒▓ ░▒▓░░░ ▒░ ░▒▒   ▓▒█░░ ▒░▓  ░▒ ▒▒ ▓▒░░ ▒░ ░  ██▒▒▒ ▒ ▒▓▒ ▒ ░
#      ░▒ ░ ▒░ ░ ░  ░ ▒   ▒▒ ░░ ░ ▒  ░░ ░▒ ▒░ ░ ░  ░▓██ ░▒░ ░ ░▒  ░ ░
#      ░░   ░    ░    ░   ▒     ░ ░   ░ ░░ ░    ░   ▒ ▒ ░░  ░  ░  ░  
#       ░        ░  ░     ░  ░    ░  ░░  ░      ░  ░░ ░           ░  
#                                                   ░ ░              
# # # # # # # # # # # # # # # # # # # #!=-=-=-=-=-=-=-=-=-=-=-=!#
# Credits:                            #!-=-=-=-=-=-=-=-=-=-=-=-!#
# - Author: JustIlas (SpigotMC)       #!  All Rights Reserved  !#
# - Created for @Skriptify (Telegram) #!-=-=-=-=-=-=-=-=-=-=-=-!#
# # # # # # # # # # # # # # # # # # # #!=-=-=-=-=-=-=-=-=-=-=-=!#

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# PERMISSIONS:
# rk.*
# rk.lock, rk.unlock, rk.get, rk.add, rk.info, rk.unlockall, rk.break, rk.reload
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


#-=-##################################-=-#
#-=-# █▀▄▀█ █▀▀ █▀ █▀ ▄▀█ █▀▀ █▀▀ █▀ #-=-#
#-=-# █░▀░█ ██▄ ▄█ ▄█ █▀█ █▄█ ██▄ ▄█ #-=-#
#-=-##################################-=-#

	# Message that appears when you lock a door ↓
	door-locked: &2&l»&a&l»&f&l» &7Door/gate/trap door locked successfully.

	# Message that appears when you unlock a door ↓
	door-unlocked: &2&l»&a&l»&f&l» &7Door/gate/trap door unlocked successfully.
	
	# Message that appears when you generate a key ↓
	give-key: &2&l»&a&l»&f&l» &7You have successfully received the key.
	
	# Message that appears when you add a door to a key ↓
	door-set: &2&l»&a&l»&f&l» &7This key can now open this door.
	
	# Message that appears when you destroy a locked door ↓
	door-broken: &2&l»&a&l»&f&l» &7You destroyed a locked door.

	# Message that appears when you try to lock an already locked door ↓
	door-already-locked: &c&l»&6&l»&e&l» &7This door is already locked.

	# Message that appears when you try to unlock a locked unlocked door ↓
	door-not-locked: &c&l»&6&l»&e&l» &7This door is not locked.
	
	# Message that appears when you try to block an iron door or something other than a door ↓
	not-a-door: &c&l»&6&l»&e&l» &7You have to look at a &nlocked&7 door, gate or trap door to execute this command.
	
	# Message that appears when you try to add the same door to a key twice ↓
	already-set: &c&l»&6&l»&e&l» &7This key already includes this door.
	
	# Message that appears when you run a command where a key is needed, but you don't have it in your hand ↓
	key-needed: &c&l»&6&l»&e&l» &7You need a key to execute this command.
	
	# Message that appears when you try to open or close a door without a key ↓
	key-needed-door: &c&l» &7You need a key to open this door.
	
	# Message that appears when you try to open or close a trap door without a key ↓
	key-needed-trapdoor: &c&l» &7You need a key to open this trap door.
	
	# Message that appears when you try to open or close a gate without a key ↓
	key-needed-gate: &c&l» &7You need a key to open this gate.
	
	# Message that appears when you try to open or close a door with a wrong key ↓
	wrong-key: &c&l» &7This is not the right key.
	
	# Message that appears when you try to break a locked door without "rk.break" permission ↓
	no-perm-break: &c&l» &7You don't have permission to destroy this door.
	
	# Message that appears when you run a command without the right permissions ↓
	no-perm-cmd: &c&l» &7Insufficient permissions.
	
	# Message that appears when you unlock all the doors ↓
	unlock-all-doors: &c&l» &7All the doors are now unlocked.


#-=-##########################-=-#
#-=-# █▀▀ █▀█ █▄░█ █▀▀ █ █▀▀ #-=-#
#-=-# █▄▄ █▄█ █░▀█ █▀░ █ █▄█ #-=-#
#-=-##########################-=-#

	# Item of the key (default: "tripwire hook") ↓
	key-item: tripwire hook

	# Prefix of the key's name ↓
	key-prefix: &b&l» &7
	
	# The default name of the keys ↓
	key-name: Key
	




#! DON'T TOUCH HERE IF YOU DON'T KNOW WHAT THIS IS !#

#-=-#####################################################-=-#
#-=-# █▀▀ █░█ █▄░█ █▀▀ ▀█▀ █ █▀█ █▄░█   █░█ █▀▀ █░░ █▀█ #-=-#
#-=-# █▀░ █▄█ █░▀█ █▄▄ ░█░ █ █▄█ █░▀█   █▀█ ██▄ █▄▄ █▀▀ #-=-#
#-=-#####################################################-=-#

function realHelp(p: player):
	send "" to {_p}
	send "&9&l»&3&l»&b&l» &f&lREALKEYS &7(by JustIlas - Telegram: @Skriptify)" to {_p}
	send "&8&l» &f/rk &8&l- &7Receive this message." to {_p}
	send "&8&l» &f/rk lock &8- &7Lock a door." to {_p}
	send "&8&l» &f/rk unlock &8&l- &7Unlock a door." to {_p}
	send "&8&l» &f/rk get &8&l- &7Receive the key to the door you look at." to {_p}
	send "&8&l» &f/rk add &8&l- &7Add a door to the key you are holding." to {_p}
	send "&8&l» &f/rk name &8&l- &7Change the name of the key." to {_p}
	send "&8&l» &f/rk info &8&l- &7See which doors a key can open." to {_p}
	send "&8&l» &f/rk unlockall &8&l- &7Unlock all doors/gates/trap doors." to {_p}
	send "&8&l» &f/rk reload &8&l- &7Reload the script." to {_p}
	send "" to {_p}

function doorContains(l: objects, text: object) :: boolean: # ):
	loop {lock::*}:
		if "%loop-value%" is "%{_text}%":
			return true
	return false

function keysContains(id: object, loc: object) :: boolean: # ):
	loop {keys::%{_id}%::*}:
		if "%loop-value%" is "%{_loc}%":
			return true
	return false


#-=-#######################################################-=-#
#-=-# █▀▄▀█ ▄▀█ █ █▄░█   █▀▀ █▀█ █▀▄▀█ █▀▄▀█ ▄▀█ █▄░█ █▀▄ #-=-#
#-=-# █░▀░█ █▀█ █ █░▀█   █▄▄ █▄█ █░▀░█ █░▀░█ █▀█ █░▀█ █▄▀ #-=-#
#-=-#######################################################-=-#

command /realkey [<string>] [<string>]:
	aliases: realkeys, rk
	trigger:
		if arg 1 is not set:
			realHelp(player)
		else:
			if arg 1 is "lock":
				if player has permission "rk.lock" or "rk.*":
					if "%targeted block%" contains "door" or "gate":
						if "%targeted block%" doesn't contain "iron":
							if doorContains({lock::*}, "%targeted block's location%") is false:
								add targeted block's location to {lock::*}
								if "%block at block 1 above targeted block%" contains "door" or "gate":
									"%block at block 1 above targeted block%" doesn't contain "trap"
									"%block at block 1 above targeted block%" doesn't contain "iron"
									add location of block at block 1 above targeted block to {lock::*}
								if "%block at block 1 under targeted block%" contains "door" or "gate":
									"%block at block 1 under targeted block%" doesn't contain "trap"
									"%block at block 1 under targeted block%" doesn't contain "iron"
									add location of block at block 1 under targeted block to {lock::*}
								send "{@door-locked}"
							else:
								send "{@door-already-locked}"
						else:
							send "{@not-a-door}"
					else:
						send "{@not-a-door}"
				else:
					send "{@no-perm-cmd}"
			else if arg 1 is "unlock":
				if player has permission "rk.unlock" or "rk.*":
					if "%targeted block%" contains "door" or "gate":
						if "%targeted block%" doesn't contain "iron":
							if doorContains({lock::*}, "%targeted block's location%") is true:
								remove targeted block's location from {lock::*}
								if "%block at block 1 above targeted block%" contains "door" or "gate":
									"%block at block 1 above targeted block%" doesn't contain "trap"
									"%block at block 1 above targeted block%" doesn't contain "iron"
									remove location of block at block 1 above targeted block from {lock::*}
								if "%block at block 1 under targeted block%" contains "door" or "gate":
									"%block at block 1 under targeted block%" doesn't contain "trap"
									"%block at block 1 under targeted block%" doesn't contain "iron"
									remove location of block at block 1 under targeted block from {lock::*}
								send "{@door-unlocked}"
							else:
								send "{@door-not-locked}"
						else:
							send "{@not-a-door}"
					else:
						send "{@not-a-door}"
				else:
					send "{@no-perm-cmd}"
			else if arg 1 is "get":
				if player has permission "rk.get" or "rk.*":
					if doorContains({lock::*}, "%targeted block's location%") is true:
						set {_l::*} to "&0", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9", "&a", "&b", "&c", "&d", "&e", "&f", "&l", "&o" and "&k"
						loop 5 times:
							set {_id} to "%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%%a random element out of {_l::*}%"
							if {keys::*} contain "%{_id}%":
								continue
							else:
								exit loop
						add {_id} to {keys::*}
						add "%targeted block's location%" to {keys::%{_id}%::*}
						if "%block at block 1 above targeted block%" contains "door" or "gate":
							"%block at block 1 above targeted block%" doesn't contain "trap"
							"%block at block 1 above targeted block%" doesn't contain "iron"
							add "%location of block at block 1 above targeted block%" to {keys::%{_id}%::*}
						if "%block at block 1 under targeted block%" contains "door" or "gate":
							"%block at block 1 under targeted block%" doesn't contain "trap"
							"%block at block 1 under targeted block%" doesn't contain "iron"
							add "%location of block at block 1 under targeted block%" to {keys::%{_id}%::*}
						give {@key-item} named "{@key-prefix}{@key-name}&r&r&r%{_id}%" to player
						send "{@give-key}"
						stop
					else:
						send "{@not-a-door}"
				else:
					send "{@no-perm-cmd}"
			else if arg 1 is "add":
				if player has permission "rk.add" or "rk.*":
					if player's held item is {@key-item}:
						if player's held item's name contains "{@key-prefix}":
							if doorContains({lock::*}, "%targeted block's location%") is true:
								if player's held item's lore contains targeted block's location:
									send "{@already-set}"
									stop
								else:
									set {_s::*} to split player's tool's name at "&r&r&r"
									set {_id} to {_s::2}
									remove "%location of targeted block%" from {keys::%{_id}%::*}
									add "%location of targeted block%" to {keys::%{_id}%::*}
									if "%block at block 1 above targeted block%" contains "door" or "gate":
										"%block at block 1 above targeted block%" doesn't contain "trap"
										"%block at block 1 above targeted block%" doesn't contain "iron"
										remove "%location of block at block 1 above targeted block%" from {keys::%{_id}%::*}
										add "%location of block at block 1 above targeted block%" to {keys::%{_id}%::*}
									if "%block at block 1 under targeted block%" contains "door" or "gate":
										"%block at block 1 under targeted block%" doesn't contain "trap"
										"%block at block 1 under targeted block%" doesn't contain "iron"
										remove "%location of block at block 1 under targeted block%" from {keys::%{_id}%::*}
										add "%location of block at block 1 under targeted block%" to {keys::%{_id}%::*}
									send "{@door-set}"
							else:
								send "{@door-not-locked}"
						else:
							send "{@key-needed}"
					else:
						send "{@no-perm-cmd}"
			else if arg 1 is "name":
				if player has permission "rk.name" or "rk.*":
					if player's held item is {@key-item}:
						if player's held item's name contains "{@key-prefix}":
							if arg 2 is set:
								set {_id} to player's tool's name
								set {_s::*} to split player's tool's name at "&r&r&r"
								set {_id} to {_s::2}
								set name of player's held item to "{@key-prefix}%colored arg 2%&r&r&r%{_id}%"
							else:
								send "&c&l»&6&l»&e&l» &7Utilizzo: &c/rk name <nome>"
						else:
							send "{@key-needed}"
					else:
						send "{@key-needed}"
				else:
					send "{@no-perm-cmd}"
			else if arg-1 is "info":
				if player has permission "rk.info" or "rk.*":
					if player's held item is {@key-item}:
						if player's held item's name contains "{@key-prefix}":
							set {_id} to player's tool's name
							set {_s::*} to split player's tool's name at "&r&r&r"
							set {_id} to {_s::2}
							broadcast "&f&l* KEY: &7%{keys::%{_id}%::*}%"
						else:
							send "{@key-needed}"
					else:
						send "{@key-needed}"
				else:
					send "{@no-perm-cmd}"
			else if arg 1 is "unlockall":
				if player has permission "rk.unlockall" or "rk.*":
					delete {keys::*}
					delete {lock::*}
					send "{@unlock-all-doors}"
				else:
					send "{@no-perm-cmd}"
			else if arg 1 is "reload":
				if player has permission "rk.reload" or "rk.*":
					execute console command "sk reload %script%"
					send "&a&l» &7Script reloaded."
				else:
					send "{@no-perm-cmd}"
			else:
				realHelp(player)


#-=-###############################################-=-#
#-=-# █▀█ ▀█▀ █░█ █▀▀ █▀█   ▀█▀ █░█ █ █▄░█ █▀▀ █▀ #-=-#
#-=-# █▄█ ░█░ █▀█ ██▄ █▀▄   ░█░ █▀█ █ █░▀█ █▄█ ▄█ #-=-#
#-=-###############################################-=-#

on right click:
	"%event-block%" contains "door" or "gate"
	"%event-block%" doesn't contain "iron"
	if doorContains({lock::*}, "%event-block's location%") is true:
		if player's tool is {@key-item}:
			if name of player's held item contains "{@key-prefix}":
				set {_s::*} to split player's tool's name at "&r&r&r"
				set {_id} to {_s::2}
				if keysContains("%{_id}%", "%location of event-block%") is false:
					cancel event
					send "{@wrong-key}"
			else:
				cancel event
				send "{@key-needed}"
		else:
			cancel event
			if "%event-block%" contains "door":
				if "%event-block%" contains "trap":
					send "{@key-needed-trapdoor}"
				else:
					send "{@key-needed-door}"
			else:
				send "{@key-needed-gate}"

on block break:
	if doorContains({lock::*}, "%event-block's location%") is true:
		if player has permission "rk.break" or "rk.*":
			remove event-block's location from {lock::*}
			if "%block at block 1 above event-block%" contains "door" or "gate":
				"%block at block 1 above targeted block%" doesn't contain "trap"
				"%block at block 1 above targeted block%" doesn't contain "iron"
				remove location of block at block 1 above event-block from {lock::*}
			if "%block at block 1 under event-block%" contains "door" or "gate":
				"%block at block 1 under targeted block%" doesn't contain "trap"
				"%block at block 1 under targeted block%" doesn't contain "iron"
				remove location of block at block 1 under event-block from {lock::*}
			send "{@door-broken}" to player
		else:
			send "{@no-perm-break}"

on place:
	player's tool is {@key-item}
	if player's tool's name contains "{@key-prefix}":
		cancel event

on load:
	send "" to console
	send "  _____            _ _  __" and " |  __ \          | | |/ /" and " | |__) |___  __ _| | ' / ___ _   _ ___" and " |  _  // _ \/ _` | |  < / _ \ | | / __|" and " | | \ \  __/ (_| | | . \  __/ |_| \__ \" and " |_|  \_\___|\__,_|_|_|\_\___|\__, |___/" and "                               __/ |    " and "                              |___/     " to console
	send "" and "&8* &fRealKeys &asuccessfully loaded&f." and "&8* &fVersion: 1.3" and "&8* &fCreated by JustIlas [Telegram: @Cattivah | @Skriptify]" and "" to console