lock-it.sk

Created by DroidVengeance

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.

#.____                  __             .______________
#|    |    ____   ____ |  | __         |   \__    ___/
#|    |   /  _ \_/ ___\|  |/ /  ______ |   | |    |   
#|    |__(  <_> )  \___|    <  /_____/ |   | |    |   
#|_______ \____/ \___  >__|_ \         |___| |____|   
#        \/          \/     \/                       

#Lock-IT by DroidVengeance
#A Skript alternative to the popular Lockette plugin
#https://www.spigotmc.org/resources/lockette-uuid-supported.3054/

#=========#	
# Aliases #
#=========#
aliases:
	any door block = 64, 193, 194, 195, 196, 197, 71, 427, 96, 167
	any fence gate = 107, 183, 184, 185, 186, 187
	

#Generate all the files and load variables#
on script load:
	send "&c&m-----------------------------------------------------" to the console
	send "&6&l.____                  __             .______________" to the console
	send "&6&l|    |    ____   ____ |  | __         |   \__    ___/" to the console
	send "&6&l|    |   /  _ \_/ ___\|  |/ /  ______ |   | |    |   " to the console
	send "&6&l|    |__(  <_> )  \___|    <  /_____/ |   | |    |   " to the console
	send "&6&l|_______ \____/ \___  >__|_ \         |___| |____|   " to the console
	send "&6&l        \/          \/     \/                        " to the console
	send "&c&m-----------------------------------------------------" to the console
	if folder "plugins/Lock-IT" doesn't exists:
		create folder "plugins/Lock-IT"
		send "%colored {lockIT.prefix}% &fCreating folder..." to the console
	if file "plugins/Lock-IT/config.yml" doesn't exists:
		download from "https://bit.ly/2MXFaCN" to "plugins/Lock-IT/config.yml"
		send "%colored {lockIT.prefix}% &fGenerating config.yml..." to the console
	if file "plugins/Lock-IT/permissions.yml" doesn't exists:
		download from "https://bit.ly/2QiZ355" to "plugins/Lock-IT/permissions.yml"
		send "%colored {lockIT.prefix}% &fGenereating permissions.yml..." to the console
	if file "plugins/Lock-IT/messages.yml" doesn't exists:
		download from "https://bit.ly/2CCG42G" to "plugins/Lock-IT/messages.yml"
		send "%colored {lockIT.prefix}% &fGenerating messages.yml..." to the console
		send "%colored {lockIT.prefix}% &2DONE!!" to the console
		send "" to the console
	send "%colored {lockIT.prefix}% &fGrabbing settings from the config..." to the console
	if {lockIT.prefix} is not set:
		set {lockIT.prefix} to single value "prefix" get of "plugins/Lock-IT/config.yml"
	if {lockIT.fastLock} is not set:
		set {lockIT.fastLock} to single value "fastLock" get of "plugins/Lock-IT/config.yml"
	if {lockIT.fastLockSetTime} is not set:
		set {lockIT.fastLockSetTime} to single value "fastLockSetTime" get of "plugins/Lock-IT/config.yml"
	if {lockIT.fastLockItems} is not set:
		set {lockIT.fastLockItems} to single value "fastLockItems" get of "plugins/Lock-IT/config.yml"
	if {lockIT.version} is not set:
		set {lockIT.version} to single value "version" get of "plugins/Lock-IT/config.yml"
	send "%colored {lockIT.prefix}% &fGrabbing all messages..." to the console
	if {lockIT.msgAlreadyLocked} is not set:
		set {lockIT.msgAlreadyLocked} to single value "msgAlreadyLocked" get of "plugins/Lock-IT/messages.yml"
	if {lockIT.msgLocked} is not set:
		set {lockIT.msgLocked} to single value "msgLocked" get of "plugins/Lock-IT/messages.yml"
	if {lockIT.msgDenied} is not set:
		set {lockIT.msgDenied} to single value "msgDenied" get of "plugins/Lock-IT/messages.yml"
	if {lockIT.useLockIT} is not set:
		set {lockIT.useLockIT} to single value "useLockIT" get of "plugins/Lock-IT/permissions.yml"
	send "%colored {lockIT.prefix}% &fGrabbing all permissions..." to the console
	if {lockIT.bypassLocked} is not set:
		set {lockIT.bypassLocked} to single value "bypassLocked" get of "plugins/Lock-IT/permissions.yml"
	if {lockIT.bypassBreak} is not set:
		set {lockIT.bypassBreak} to single value "bypassBreak" get of "plugins/Lock-IT/permissions.yml"
	if {lockIT.bypassModify} is not set:
		set {lockIT.bypassModify} to single value "bypassModify" get of "plugins/Lock-IT/permissions.yml"
	send "%colored {lockIT.prefix}% &2DONE! ENJOY!" to the console
	send "%colored {lockIT.prefix}% You are running Version: &d%{lockIT.version}%" to the console
	set {_verCheck} to text from "https://bit.ly/2NwSz43"
	if {_verCheck} is not {lockIT.version}:
		send "%colored {lockIT.prefix}% The most recent Version: &d%{lockIT.version}%" to the console
		
	



	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

	
#Commands#
command /lockit [<integer>] [<text>]:
	permission: {lockIT.useLockIT}
	trigger:
		set {_msgSignUpdated} to single value "msgSignUpdated" get of "plugins/Lock-IT/messages.yml"
		set {_msgSignUpdateError} to single value "msgSignUpdateError" get of "plugins/Lock-IT/messages.yml"
		set {_msgFixed} to single value "msgFixed" get of "plugins/Lock-IT/messages.yml"
		if arg 1 is set:
			if arg 2 is not set:
				set line arg 1 of block at {updateSignLoc.%player%} to " "
				delete {updateSignLoc.%player%}
				message "%{lockIT.prefix}% %{_msgSignUpdated}%"
				stop
			if arg 1 is 2:
				message "%{lockIT.prefix}% %{_msgSignUpdateError}%"
				stop
			else:
				set line arg 1 of block at {updateSignLoc.%player%} to arg 2
				delete {updateSignLoc.%player%}
				message "%{lockIT.prefix}% %{_msgSignUpdated}%"
				stop
		if arg 2 is "fix":
			if line 1 of target block is "[Private]" or "[private]":
				if line 2 of target block contains "%player%" or UUID of player:		
					toggle block behind target block
					message "%{lockIT.prefix}% %{_msgFixed}%"
					stop

		if arg 2 is "help":
			message "&4&m---------------------------------------------------"
			message "%{lockIT.prefix}% &eby DroidVengeance"
			message "&4&m---------------------------------------------------"
			message "  - &eShift+Rightclicking while holding a sign, will automatically lock those items."
			message "  - &eTo edit a sign, rightclick and use:"
			message "    - &e/lockit <line number> <text>"
			message "  - &eTo fix a door use:"
			message "    - &e/lockit fix"
			stop
		if arg 1 is not set:
			message "%{lockIT.prefix}% &eUse /lockit help"
			stop


#Fast Lock#
on place of wall sign:
	if player is sneaking:
		if {lockIT.fastLock} is not false:
			if player has permission "%{lockIT.useLockIT}%":
				if line 1 of block is "[Private]" or "[private]":
					cancel event
					message "%{lockIT.prefix}% &c%{lockIT.msgAlreadyLocked}%"
				if block behind event-block is a any door block or any trapdoors or chest or trapped chest or furnace or ender chest or enchantment table or crafting table or dropper or dispenser or hoppers or anvil or jukebox:
					close player's inventory
					wait 1 seconds
					set line 1 of block to "[Private]"
					set line 2 of block to "%player%            %UUID of player%"
					message "%{lockIT.prefix}% &e%{lockIT.msgLocked}%"
					stop

#Item protection system#				
on right click on a any door block or any trapdoors or chest or trapped chest or furnace or ender chest or enchantment table or crafting table or dropper or dispenser or hoppers or anvil or jukebox:
	loop blocks in radius 2 of clicked block:
		if line 1 of loop-block is "[Private]" or "[private]":
			#if line 2 of loop-block is "%player%":
			if line 2 of loop-block contains "%player%" or UUID of player:
				wait 1 tick
				stop
			if line 2 of loop-block does not contain "%player%" or UUID of player:
				if player has permission "%{lockIT.bypassLocked}%":
					stop
				if line 3 of loop-block contains "%player%" or UUID of player or "[Everyone]" or "[everyone]":
					wait 1 tick
					stop
				if line 4 of loop-block contains "%player%" or UUID of player or "[Everyone]" or "[everyone]":
					wait 1 tick
					stop
				else:
					cancel event
					message "%{lockIT.prefix}% &c%{lockIT.msgDenied}%"
					stop
				

#Timers	
on right click:
	set {_msgCannotUse} to single value "msgCannotUse" get of "plugins/Lock-IT/messages.yml"
	if clicked block is iron door:
		loop blocks in radius 3 of clicked block:
			if line 1 of loop-block is "[Private]" or "[private]":
				if line 2 of loop-block contains UUID of player:
					open the clicked block
					wait 2 ticks
					if line 4 of loop-block is "[timer:1]":
						wait 1 seconds
						close the clicked block
						stop
					if line 4 of loop-block is "[timer:2]":
						wait 2 seconds
						close the clicked block
						stop
					if line 4 of loop-block is "[timer:3]":
						wait 3 seconds
						close the clicked block
						stop
					if line 4 of loop-block is "[timer:4]":
						wait 4 seconds
						close the clicked block
						stop
					if line 4 of loop-block is "[timer:5]":
						wait 5 seconds
						close the clicked block
						stop
	if clicked block is any door block:
		loop blocks in radius 3 of clicked block:
			if line 1 of loop-block is "[Private]" or "[private]":
				if line 2 of loop-block contains "%player%" or UUID of player:
					if line 4 of loop-block is "[timer:1]":
						wait 1 seconds
						toggle the clicked block
						stop
					if line 4 of loop-block is "[timer:2]":
						wait 2 seconds
						toggle the clicked block
						stop
					if line 4 of loop-block is "[timer:3]":
						wait 3 seconds
						toggle the clicked block
						stop
					if line 4 of loop-block is "[timer:4]":
						wait 4 seconds
						toggle the clicked block
						stop
					if line 4 of loop-block is "[timer:5]":
						wait 5 seconds
						toggle the clicked block
					stop
				if line 2 of loop-block does not contain UUID of player:
					if player does not have permission "%{lockIT.bypassLocked}%":
						if line 3 of loop-block contains "%player%" or UUID of player or "[Everyone]" or "[everyone]":
							if line 4 of loop-block is "[timer:1]":
								wait 1 seconds
								toggle the clicked block
								stop
							if line 4 of loop-block is "[timer:2]":
								wait 2 seconds
								toggle the clicked block
								stop
							if line 4 of loop-block is "[timer:3]":
								wait 3 seconds
								toggle the clicked block
								stop
							if line 4 of loop-block is "[timer:4]":
								wait 4 seconds
								toggle the clicked block
								stop
							if line 4 of loop-block is "[timer:5]":
								wait 5 seconds
								toggle the clicked block
							stop
					else:
						stop
	if clicked block is oak fence gate:
		loop blocks in radius 2 of clicked block:
			if line 1 of loop-block is "[Private]" or "[private]":
				if line 2 of loop-block contains "%player%" or UUID of player:
					if line 4 of loop-block is "[timer:1]":
						wait 1 seconds
						toggle the clicked block
						stop
					if line 4 of loop-block is "[timer:2]":
						wait 2 seconds
						toggle the clicked block
						stop
					if line 4 of loop-block is "[timer:3]":
						wait 3 seconds
						toggle the clicked block
						stop
					if line 4 of loop-block is "[timer:4]":
						wait 4 seconds
						toggle the clicked block
						stop
					if line 4 of loop-block is "[timer:5]":
						wait 5 seconds
						toggle the clicked block
					stop
				if line 2 of loop-block does not contain UUID of player:
					if player does not have permission "%{lockIT.bypassLocked}%":
						if line 3 of loop-block contains "%player%" or UUID of player or "[Everyone]" or "[everyone]":
							if line 4 of loop-block is "[timer:1]":
								wait 1 seconds
								toggle the clicked block
								stop
							if line 4 of loop-block is "[timer:2]":
								wait 2 seconds
								toggle the clicked block
								stop
							if line 4 of loop-block is "[timer:3]":
								wait 3 seconds
								toggle the clicked block
								stop
							if line 4 of loop-block is "[timer:4]":
								wait 4 seconds
								toggle the clicked block
								stop
							if line 4 of loop-block is "[timer:5]":
								wait 5 seconds
								toggle the clicked block
							stop
					else:
						stop
				if line 2 of loop-block does not contain "%player%" or UUID of player:
					cancel event
					message "%{lockIT.prefix}% %{msgCannotUse}%"
					stop
				
#Protection mechanics#
on break:
	set {_msgCannotBreak} to single value "msgCannotBreak" get of "plugins/Lock-IT/messages.yml"
	if line 1 of event-block is "[Private]" or "[private]":
		if player has permission "%{lockIT.bypassBreak}%":
			stop
		if line 2 of event-block contains UUID of player:
			stop
		else:
			cancel event
			message "%{lockIT.prefix}% %{_msgCannotBreak}%"
			stop
	loop blocks in radius 2 of event-block:
		if line 1 of loop-block is "[Private]" or "[private]":
			cancel event
			message "%{lockIT.prefix}% %{_msgCannotBreak}%"
			stop
				
#Sign updating#			
on right click on wall sign:
	set {_msgUpdateSign} to single value "msgUpdateSign" get of "plugins/Lock-IT/messages.yml"
	if line 1 of clicked block is "[Private]":
		if line 2 of clicked block does not contain UUID of player:
			if player has permission "%{lockIT.bypassModify}%":
				set {updateSignLoc.%player%} to location of clicked block
				message "%{lockIT.prefix}% %{_msgUpdateSign}%"
				stop
		if line 2 of clicked block contains UUID of player:
			set {updateSignLoc.%player%} to location of clicked block
			message "%{lockIT.prefix}% %{_msgUpdateSign}%"