execute store result score .maidplayers maid.values if entity @a[team=maid]
execute if score .maidplayers maid.values matches 2.. run return run title @a[team=maid] actionbar {"translate":"toomanyplayers","color":"red"}

execute as @e[tag=maid.tv.noise,type=item_display,scores={maid.values=1..}] run function ws:work/misc/tier2/maid/tvactive

execute as @a[team=maid,advancements={ws:broom=false}] run function ws:work/misc/tier2/maid/defaultbroom
advancement revoke @a only ws:broom

execute as @a[team=maid,advancements={ws:mop=false}] run function ws:work/misc/tier2/maid/defaultmop
advancement revoke @a only ws:mop

execute at @p[team=maid] rotated ~ 0 as @e[tag=maid.carry,type=item_display] run tp ^ ^0.75 ^1
execute as @e[tag=maid.carry] at @s unless block ~ ~ ~ #minecraft:stairs unless block ~ ~ ~ #minecraft:wool_carpets unless block ~ ~ ~ #minecraft:beds unless block ~ ~ ~ #minecraft:slabs unless block ~ ~ ~ #minecraft:doors unless block ~ ~ ~ #minecraft:air at @a[team=maid] run function ws:work/misc/tier2/maid/shatter

execute as @e[tag=maid.place,type=interaction] if data entity @s interaction run function ws:work/misc/tier2/maid/place
execute if entity @e[tag=plate,tag=maid.carry,type=item_display] at @e[tag=maid.reward.plate,type=interaction] run particle minecraft:reverse_portal ~ ~0.2 ~ 0 0 0 0.01 1 normal @a[team=maid]
execute if entity @e[tag=cup,tag=maid.carry,type=item_display] at @e[tag=maid.reward.cup,type=interaction] run particle minecraft:reverse_portal ~ ~0.2 ~ 0 0 0 0.01 1 normal @a[team=maid]
execute if entity @e[tag=maid.carry,type=item_display] at @e[tag=maid.place,tag=!maid.reward,type=interaction] run particle dust{color:[1.000,0.000,0.000],scale:1} ~ ~0.2 ~ 0 0 0 1 1 normal @a[team=maid]

execute as @e[tag=maid.getitems,type=interaction] if data entity @s interaction run function ws:work/misc/tier2/maid/gettools
kill @e[type=minecraft:item,nbt={Item:{components:{"minecraft:custom_data":{mop:1}}}}]
kill @e[type=minecraft:item,nbt={Item:{components:{"minecraft:custom_data":{broom:1}}}}]

execute as @a[team=maid] if score @s maid.capital matches 1.. at @s run function ws:work/misc/tier2/maid/pay

scoreboard players add .maidevent maid.values 1
execute if score .maidevent maid.values matches 400.. run function ws:work/misc/tier2/maid/selectevent