execute as @e[type=item,tag=!plussed,nbt={Item:{id:"minecraft:observer",components:{"minecraft:custom_data":{delsentry:tag}}}}] run tag @s add sentryegg
execute as @e[type=item,tag=!plussed,nbt={Item:{id:"minecraft:observer",components:{"minecraft:custom_data":{delsnipsentry:tag}}}}] run tag @s add snipsentryegg
execute at @e[tag=sentryegg] run kill @n[type=item,tag=!plussed,nbt={Item:{id:"minecraft:armor_stand"}},distance=..2]
execute at @e[tag=snipsentryegg] run kill @n[type=item,tag=!plussed,nbt={Item:{id:"minecraft:armor_stand"}},distance=..2]
execute at @e[tag=sentryegg] run summon item ~ ~ ~ {Item:{id:skeleton_spawn_egg,components:{item_model:bow,custom_data:{nospawner:tag},entity_data:{id:armor_stand,Pose:{LeftArm:[280f,50f,0f],RightArm:[280f,351f,0f]},ShowArms:1b,DisabledSlots:4013373,Tags:[sentry,trap,special,plussed],equipment:{mainhand:{id:bow,components:{custom_data:{delsentry:tag}}},legs:{id:leather_leggings,components:{custom_data:{delsentry:tag},dyed_color:11546150}},chest:{id:leather_chestplate,components:{custom_data:{delsentry:tag},dyed_color:11546150}},head:{id:observer,components:{custom_data:{delsentry:tag}}},drop_chances:{feet:2f,legs:0f,chest:0f,head:0f,mainhand:0f}}},item_name:"Sentry",lore:[{"text":"Targets nearby hostile mobs","italic":false,"color":"gray"},{"text":"Place to setup","italic":false,"color":"gray"}]}}}
execute at @e[tag=snipsentryegg] run summon item ~ ~ ~ {Item:{id:skeleton_spawn_egg,components:{item_model:bow,custom_data:{nospawner:tag},entity_data:{id:armor_stand,Pose:{LeftArm:[280f,50f,0f],RightArm:[280f,351f,0f]},ShowArms:1b,DisabledSlots:4013373,Tags:[snipsen,sentry,trap,special,plussed],equipment:{mainhand:{id:crossbow,components:{custom_data:{delsentry:tag},charged_projectiles:[{id:"minecraft:arrow",count:1b}]}},legs:{id:leather_leggings,components:{custom_data:{delsentry:tag},dyed_color:8948358}},chest:{id:leather_chestplate,components:{custom_data:{delsentry:tag},dyed_color:8948358}},head:{id:observer,components:{custom_data:{delsnipsentry:tag}}}},drop_chances:{feet:2f,legs:0f,chest:0f,head:0f,mainhand:0f}},item_name:"Sniper Sentry",lore:[{"text":"Targets hostile mobs","italic":false,"color":"gray"},{"text":"Place to setup","italic":false,"color":"gray"}]}}}
tag @e remove sentryegg
tag @e remove snipsentryegg
execute as @e[type=item,tag=!plussed,nbt={Item:{components:{"minecraft:custom_data":{delsentry:tag}}}}] run kill @s
execute as @e[type=item,tag=!plussed,nbt={Item:{components:{"minecraft:custom_data":{delsnipsentry:tag}}}}] run kill @s