execute if items entity @s container.* *[custom_data~{samsung_phone:true}] if score #max_phones value > #samsung_phones_for_sale value if score #one_ui_version value matches 1.. run playsound entity.player.levelup ui @s ~ ~ ~
execute if items entity @s container.* *[custom_data~{samsung_phone:true}] if score #max_phones value > #samsung_phones_for_sale value if score #one_ui_version value matches 1.. run tellraw @s {text:"You sold a Samsung Phone!",color:green}
execute if items entity @s container.* *[custom_data~{samsung_phone:true}] if score #max_phones value > #samsung_phones_for_sale value if score #one_ui_version value matches 1.. run advancement grant @s only samsung:sell_phone
execute if items entity @s container.* *[custom_data~{samsung_phone:true}] unless score #max_phones value > #samsung_phones_for_sale value if score #one_ui_version value matches 1.. run tellraw @s {text:"Error! Your slots are full!",color:red}
execute if items entity @s container.* *[custom_data~{samsung_phone:true}] if score #max_phones value > #samsung_phones_for_sale value unless score #one_ui_version value matches 1.. run tellraw @s {text:"Error! You need to have at least One UI 1 to sell a Samsung Phone!",color:red}
execute if items entity @s container.* *[custom_data~{samsung_phone:true}] if score #max_phones value > #samsung_phones_for_sale value if score #one_ui_version value matches 1.. run scoreboard players add #samsung_phones_for_sale value 1
execute if items entity @s container.* *[custom_data~{samsung_phone:true}] if score #max_phones value > #samsung_phones_for_sale value if score #one_ui_version value matches 1.. run clear @s *[custom_data={samsung_phone:true}] 1