tag @s remove has_flag

execute store result storage pctf:map input.map_id int 1 run scoreboard players get @s on_map

execute if entity @s[tag=has_light_purple_flag,tag=!no_drop] run tellraw @a[distance=..250] ["",{"selector":"@s"},{"text":" has dropped the "},{"text":"Magenta Flag","color":"light_purple"},{"text":"!"}]
execute if entity @s[tag=has_aqua_flag,tag=!no_drop] run tellraw @a[distance=..250] ["",{"selector":"@s"},{"text":" has dropped the "},{"text":"Aqua Flag","color":"aqua"},{"text":"!"}]
execute if entity @s[tag=has_yellow_flag,tag=!no_drop] run tellraw @a[distance=..250] ["",{"selector":"@s"},{"text":" has dropped the "},{"text":"Yellow Flag","color":"yellow"},{"text":"!"}]
execute if entity @s[tag=has_green_flag,tag=!no_drop] run tellraw @a[distance=..250] ["",{"selector":"@s"},{"text":" has dropped the "},{"text":"Green Flag","color":"green"},{"text":"!"}]

execute if entity @s[tag=has_light_purple_flag,tag=!no_drop] run function pctf:create_game_object/flag/drop/light_purple with storage pctf:map input
execute if entity @s[tag=has_yellow_flag,tag=!no_drop] run function pctf:create_game_object/flag/drop/yellow with storage pctf:map input
execute if entity @s[tag=has_aqua_flag,tag=!no_drop] run function pctf:create_game_object/flag/drop/aqua with storage pctf:map input
execute if entity @s[tag=has_green_flag,tag=!no_drop] run function pctf:create_game_object/flag/drop/green with storage pctf:map input

execute if entity @s[tag=has_light_purple_flag,tag=no_drop] run tellraw @a[distance=..250] ["",{"text":"The "},{"text":"Magenta Flag","color":"light_purple"},{"text":" has been returned!"}]
execute if entity @s[tag=has_aqua_flag,tag=no_drop] run tellraw @a[distance=..250] ["",{"text":"The "},{"text":"Aqua Flag","color":"aqua"},{"text":" has been returned!"}]
execute if entity @s[tag=has_yellow_flag,tag=no_drop] run tellraw @a[distance=..250] ["",{"text":"The "},{"text":"Yellow Flag","color":"yellow"},{"text":" has been returned!"}]
execute if entity @s[tag=has_green_flag,tag=no_drop] run tellraw @a[distance=..250] ["",{"text":"The "},{"text":"Green Flag","color":"green"},{"text":" has been returned!"}]

execute if entity @s[tag=has_light_purple_flag,tag=no_drop] run function pctf:create_game_object/flag/light_purple with storage pctf:map input
execute if entity @s[tag=has_yellow_flag,tag=no_drop] run function pctf:create_game_object/flag/yellow with storage pctf:map input
execute if entity @s[tag=has_aqua_flag,tag=no_drop] run function pctf:create_game_object/flag/aqua with storage pctf:map input
execute if entity @s[tag=has_green_flag,tag=no_drop] run function pctf:create_game_object/flag/green with storage pctf:map input

tag @s remove has_light_purple_flag
tag @s remove has_yellow_flag
tag @s remove has_aqua_flag
tag @s remove has_green_flag