lockout.sk

Created by TonyMaster21

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.

# ---------------------
# LockoutX v1.0.6
# By TonyMaster21
# ---------------------

# Edit the options below to customize your messages.

options:
	prefix: &4LockoutX &8ยป &7
	setpassword: You must set a lockout password with /lockout [password]!
	login: You must login with /login [password]!
	passwordset: You already have a password set!
	loginsuccess: Successfully logged in.
	passsuccess: Password set!
	enterpass: You must enter a password!
	incorrectpass: Incorrect password.
	alreadyloggedin: You are already logged in!
	
	blockmovement: false
	
# Editing anything below this line may break this script.

function lockoutMsg(msg: text, p: player):
	message "{@prefix}%{_msg}%" to {_p}

function lockoutBlock(p: player) :: boolean:
	set {_u} to {_p}'s uuid
	if {lockout::%{_u}%::status} is not set:
		lockoutMsg("{@login}", {_p})
		return false
		stop
	else:
		return true

function lockoutSalt(p: text) :: text:
	set {_salt} to hashed "LoCKoUTx_by_TonYMasTeR_%{_p}%_LoCKoUTx_by_TonYMasTeR"
	return {_salt}

on join:
	if {lockout::%player's uuid%} is not set:
		lockoutMsg("{@setpassword}", player)
		stop
	lockoutMsg("{@login}", player)
	stop

on click:
	if lockoutBlock(player) is false:
		cancel event

on damage:
	if lockoutBlock(attacker) is false:
		cancel event
	if lockoutBlock(victim) is false:
		cancel event
		
on any movement:
	if {@blockmovement} is true:
		if lockoutBlock(player) is false:
			cancel event
	
on command:
	if command is not "lockout" or "login"
		if {lockout::%player's uuid%::status} is not set:
			lockoutMsg("{@login}", player)
			cancel event

on chat:
	if lockoutBlock(player) is false:
		cancel the event

on quit:
	delete {lockout::%player's uuid%::status}

command /login [<text>]:
	trigger:
		if {lockout::%player's uuid%::status} is not set:
			if {lockout::%player's uuid%} is not set:
				lockoutMsg("{@setpassword}", player)
				stop
			if arg 1 is not set:
				lockoutMsg("{@enterpass}", player)
				stop
			if {lockout::%player's uuid%} is not lockoutSalt(arg 1):
				lockoutMsg("{@incorrectpass}", player)
				stop
			lockoutMsg("{@loginsuccess}", player)
			set {lockout::%player's uuid%::status} to true
		else:
			lockoutMsg("{@alreadyloggedin}", player)

command /lockout [<text>]:
	trigger:
		if {lockout::%player's uuid%} is set:
			lockoutMsg("{@passwordset}", player)
			stop
		if arg 1 is not set:
			lockoutMsg("{@enterpass}", player)
			stop
		set {lockout::%player's uuid%} to lockoutSalt(arg 1)
		lockoutMsg("{@passsuccess}", player)
		set {lockout::%player's uuid%::status} to true

command /lockoutx:
	trigger:
		message "LockoutX by TonyMaster21, version 1.0.6"