# Claim a VALID Scavenger Beacon armor stand only (prevents normal stands from being used)
tag @e[type=armor_stand,nbt={CustomName:'{"text":"Scavenger Beacon","color":"gold","bold":true}'}] add ScavengerBeacon
tag @e[type=armor_stand,nbt={CustomName:'{"text":"Scavenger Beacon"}'}] add ScavengerBeacon

execute unless entity @e[type=armor_stand,nbt={CustomName:'{"text":"ScavengerBase"}'}] run execute as @p at @s run execute as @e[type=armor_stand,tag=ScavengerBeacon,limit=1,sort=nearest] run data merge entity @s {CustomName:'{"text":"ScavengerBase"}'}

execute as @e[type=armor_stand,nbt={CustomName:'{"text":"ScavengerBase"}'},limit=1,sort=nearest] at @s run tellraw @a[distance=..12] {"text":"The Scavenger has arrived at your base... be sure to check his loots","color":"dark_green","bold":true}
execute as @e[type=armor_stand,nbt={CustomName:'{"text":"ScavengerBase"}'},limit=1,sort=nearest] at @s unless entity @a[distance=..12] run tellraw @a {"text":"The Scavenger has arrived at your base... be sure to check his loots","color":"dark_green","bold":true}

execute if entity @e[type=armor_stand,nbt={CustomName:'{"text":"ScavengerBase"}'}] run function scavenger:beacon_boot
