scoreboard players add @s spectating 0
clear @s *[custom_data={lobby.dye:1b}]
execute at @s run kill @e[type=item,distance=0..2]
execute if score @s spectating matches 0 run item replace entity @s hotbar.4 with lime_dye[food={nutrition:0,saturation:0,can_always_eat:true},consumable={consume_seconds:0,animation:"none",sound:"ui.toast.in",has_consume_particles:false,on_consume_effects:[{type:"minecraft:play_sound",sound:"ui.toast.in"}]},custom_name={"color":"#3CFF2E","italic":false,"translate":"subchronos.lobby.spectate_button","fallback":"Click to Spectate"},custom_data={lobby.dye:1b}] 1
execute if score @s spectating matches 1 run item replace entity @s hotbar.4 with gray_dye[food={nutrition:0,saturation:0,can_always_eat:true},consumable={consume_seconds:0,animation:"none",sound:"ui.toast.in",has_consume_particles:false,on_consume_effects:[{type:"minecraft:play_sound",sound:"ui.toast.in"}]},custom_name={"color":"#666666","italic":false,"translate":"subchronos.lobby.play_button","fallback":"Click to Play"},custom_data={lobby.dye:1b}] 1
