#[ Credits Hover Smarty ]#

#: actionbar msg
execute if score credits.smartyalek BUTTONS matches 1 run title @a actionbar [{"text":" ","bold":true}]
execute as @a[predicate=lobby:looking_at/credits/smartyalek_youtube] run title @s actionbar [{"text":"[ SmartyAlek Youtube ]","bold":true}]

#: check if inactive
execute unless score credits.smartyalek BUTTONS matches 0 if entity @a[predicate=lobby:looking_at/credits/smartyalek_youtube] run return 0

#: change state icon
$data merge entity @e[type=text_display,tag=smartyalek_youtube,limit=1] {transformation:{scale:[$(scale)f,$(scale)f,$(scale)f]},text:'[{"color":"white","text":"@SmartyAlek","underlined":$(underlined),"bold":false}]'}
# text set value '{"color":"white","text":"@SmartyAlek","underlined":$(underlined)}'

#: playsound
execute if score credits.smartyalek BUTTONS matches 0 as @a at @s run playsound block.metal_pressure_plate.click_on ambient @s ~ ~ ~ 1 1.98
execute if score credits.smartyalek BUTTONS matches 0 as @a at @s run playsound block.note_block.chime ambient @s ~ ~ ~ 1 1.5

#: swap states
execute unless score credits.smartyalek BUTTONS matches 1 run return run scoreboard players set credits.smartyalek BUTTONS 1
execute if score credits.smartyalek BUTTONS matches 1 run return run scoreboard players set credits.smartyalek BUTTONS 0
