I made the following skript:
If I did /wlb add and looked at any block it will say the block has been added to the whitelisted blocks and /wlb list shows the block on the list. If I place the block I just whitelisted then break it for some reason it adds air to the list even if it is already on the list and the block I whitelisted is removed from the list. I can't think of any reason why this might happen but I'd appreciate a fix
Code:
command /whitelistblock [<text>]:
aliases: wlb
permission: blockedup.whitelistblock
permission message: &cInsufficient permissions.
trigger:
if arg-1 isn't set:
send "&f/wlb add"
send "&f/wlb remove"
send "&f/wlb list"
else if arg-1 is "add":
if target block isn't set:
send "&cYou must be looking at a block to execute this command."
else if {whitelistedBlocks::*} contains target block:
send "&aThis block has already been whitelisted."
else:
send "&a%target block% &ahas been added to the whitelisted blocks."
add target block to {whitelistedBlocks::*}
else if arg-1 is "remove":
if target block isn't set:
send "&cYou must be looking at a block to execute this command."
else if {whitelistedBlocks::*} does not contain target block:
send "&cThis has already been removed from the whitelist."
else:
send "&c%target block% has been removed from the whitelist."
remove target block from {whitelistedBlocks::*}
else if arg-1 is "list":
loop {whitelistedBlocks::*}:
send "%loop-value%"
command /build:
aliases: togglebuild, tb, buildmode, bm, b
permission: blockedup.build
permission message: &cInsufficient permissions.
trigger:
if {toggleBuild.%player%} is true:
set {toggleBuild.%player%} to false
send "&cBuild Mode has been disabled."
else:
set {toggleBuild.%player%} to true
send "&aBuild Mode has been enabled."
on break:
if {toggleBuild.%player%} is not true:
if player is in the region "mainzone":
loop {whitelistedBlocks::*}:
if {_whitelistedBlock} isn't true:
if "%event-block%" == "%loop-value%":
set {_whitelistedBlock} to true
if {_whitelistedBlock} isn't true:
send "&cYou cannot break this block in the Main Zone."
cancel event
on place:
if {toggleBuild.%player%} is not true:
if player is in the region "mainzone":
loop {whitelistedBlocks::*}:
if {_whitelistedBlock} isn't true:
if "%event-block%" == "%loop-value%":
set {_whitelistedBlock} to true
if {_whitelistedBlock} isn't true:
send "&cYou cannot place this block in the Main Zone."
cancel event
else:
wait 5 minutes
set event-block to air