#[ Credits Hover Smarty ]#

#: actionbar msg
execute if score credits.mundimaps BUTTONS matches 1 run title @a actionbar [{"text":" ","bold":true}]
execute as @a[predicate=lobby:looking_at/credits/mundimaps_discord] run title @s actionbar [{"text":"[ Mundi Maps Discord ]","bold":true}]

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

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

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

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