options:
protected_regions: "koth_ring, spawn_region, arena"
timer: 1800
on first join:
set {firstJoin::%player's uuid%} to {@timer}
on join:
wait 1 tick
if {firstJoin::%player's uuid%} is set:
while player is online:
remove 1 from {firstJoin::%player's uuid%}
if {firstJoin::%player's uuid%} is less than or equal to 0:
delete {firstJoin::%player's uuid%}
send action bar "&a&lYou are no longer protected!" to player
send title "&aYou are no longer protected!" to player
send "&a&lYou are no longer protected!" to player
stop
wait 1 second
on damage of player:
if {firstJoin::%victim's uuid%} is set:
cancel event
send action bar "&c&lYou cannot damage &a&lnew protected&c&l players&c." to attacker
if attacker is set:
if {firstJoin::%attacker's uuid%} is set:
cancel event
set {_t} to "%{firstJoin::%attacker's uuid%}% seconds" parsed as timespan
send action bar "&c&lYou cannot damage other players when &a&lprotected&c. &7(%{_t}%)" to attacker
send "&cDue to being a new player, you are currently &a&lprotected&c for %{_t}% and cannot be attacked. To disable this, use &a&l/noprotection&c." to attacker
on pickup:
if {firstJoin::%player's uuid%} is set:
set {_dropper} to "%event-item's last owner%"
if {_dropper} is "%player%":
stop
cancel event
if {pickupCooldown::%player's uuid%} is not set:
set {_t} to "%{firstJoin::%player's uuid%}% seconds" parsed as timespan
send action bar "&c&lYou cannot pick up items when &a&lprotected&c. &7(%{_t}%)" to player
send "&cDue to being a new player, you are currently &a&lprotected&c for %{_t}% and cannot pick up player-dropped items. To disable this, use &a&l/noprotection&c." to player
set {pickupCooldown::%player's uuid%} to true
wait 5 seconds
delete {pickupCooldown::%player's uuid%}
command /protectiontimer <player> <integer>:
permission: *
trigger:
set {firstJoin::%arg-1's uuid%} to arg-2
send "&aSet %arg-1%'s protection timer to %arg-2% seconds." to player
send "&aYour protection timer is now %arg-2% seconds." to arg-1
command /noprotection:
trigger:
if {firstJoin::%player's uuid%} is set:
delete {firstJoin::%player's uuid%}
send action bar "&a&lYou are no longer protected!" to player
send title "&aYou are no longer protected!" to player
send "&a&lYou are no longer protected!" to player
stop
send "&cYou are not protected." to player