options: storage: doors prefix: &c&lDoors ยป time: 6 seconds input error: &cIncorrect input, please enter a 4 number password (for example 1234) input length: &cPassword size incorrect, a password is 4 numbers long (for example 1234) cancel wait: &cProccess calceled, took too long sound: ENTITY_EXPERIENCE_ORB_PICKUP function Door_PasswordFormat(pas: string) :: string: set {_numbers::*} to {_pas} split at "" set {_str} to "" loop {_numbers::*}: add 1 to {_count} if {_count} < 4: set {_str} to "%{_str}%%loop-value%-" else: set {_str} to "%{_str}%%loop-value%" return {_str} function Door_PlayerReset(p: player): set {_u} to uuid of {_p} delete {{@storage}::player::%{_u}%::doors::start} delete {{@storage}::player::%{_u}%::doors::loc} delete {{@storage}::player::%{_u}%::doors::password} on place of door: set {{@storage}::player::%uuid of player%::doors::setup} to location of event-block send "{@prefix} &7Please enter a password of 4 numbers for the door (for example 1234)" on break of door: if {{@storage}::location::%location of event-block%::owner} is set: set {_loc} to location of event-block else if {{@storage}::location::%location of block above event-block%::owner} is set: set {_loc} to location of block above event-block else if {{@storage}::location::%location of block below event-block%::owner} is set: set {_loc} to location of block below event-block else: stop delete {{@storage}::location::%{_loc}%::owner} delete {{@storage}::location::%{_loc}%::password} send "{@prefix} &cDoor Information Deleted" on rightclick on door: if {{@storage}::location::%location of event-block%::owner} is set: set {_loc} to location of event-block else if {{@storage}::location::%location of block above event-block%::owner} is set: set {_loc} to location of block above event-block else if {{@storage}::location::%location of block below event-block%::owner} is set: set {_loc} to location of block below event-block else: stop if {{@storage}::location::%{_loc}%::owner} isn't player: cancel event if {{@storage}::player::%uuid of player%::doors::start} is set: set {_wait} to difference between now and {{@storage}::player::%uuid of player%::doors::start} if {_wait} >= {@time}: Door_PlayerReset(player) stop # broadcast "Owner: %{{@storage}::location::%{_loc}%::owner}%" # broadcast "Location: %{_loc}%" send title "&c&lLocked Door!" with subtitle "&cPassword: &7X-X-X-X" to player for {@time} send "{@prefix} &7Please enter a password of 4 numbers (for example 1234) within the next {@time}" set {{@storage}::player::%uuid of player%::doors::loc} to {_loc} set {{@storage}::player::%uuid of player%::doors::start} to now set {{@storage}::player::%uuid of player%::doors::password} to {{@storage}::location::%{_loc}%::password} on chat: if {{@storage}::player::%uuid of player%::doors::setup} is set: cancel event if length of message is 4: set {_numbers::*} to message split at "" loop {_numbers::*}: set {_temp} to "%loop-value%" parsed as integer if {_temp} >= 0: add 1 to {_count} else: #Less than 0 or not an integer send "{@prefix} {@input error}" stop set {_loc} to {{@storage}::player::%uuid of player%::doors::setup} set {{@storage}::location::%{_loc}%::owner} to player # broadcast "Location: %{_loc}%" # broadcast "Owner: %{{@storage}::location::%{_loc}%::owner}%" set {{@storage}::location::%{_loc}%::password} to message delete {{@storage}::player::%uuid of player%::doors::setup} send "{@prefix} &7Successfully set a door with the password &f%message%" else: send "{@prefix} {@input length}" else if {{@storage}::player::%uuid of player%::doors::start} is set: cancel event set {_wait} to difference between now and {{@storage}::player::%uuid of player%::doors::start} if {_wait} >= {@time}: Door_PlayerReset(player) send "{@prefix} {@cancel wait}" else: if length of message is 4: if message is {{@storage}::player::%uuid of player%::doors::password}: send player title "&a&lDoor Unlocked!" with subtitle "&aPassword: &7%Door_PasswordFormat(message)%" for 3 seconds with 1 second fade in and 1 second fade out set {_loc} to {{@storage}::player::%uuid of player%::doors::loc} toggle block at {_loc} Door_PlayerReset(player) play "{@sound}" to player wait 2 seconds toggle block at {_loc} else: send "{@prefix} &cIncorrect Password" else: send "{@prefix} {@input length}"