execute if score .host_mode settings matches 1 unless entity @s[tag=op] run return run tellraw @s {"text":"\nYou do not have permission to use the Map Creator in Host Mode!! To toggle Host Mode an operator must type `/function pctf:host_mode/toggle`","color":"red"}
execute if score .time_till_tp countdown matches 1.. run return run tellraw @s {"text":"You cannot create a map when a game is about to start!","color":"red"}
tp @s 0 100 0

execute if entity @s[tag=playing] run return run tellraw @s {"text":"You cannot enter map making mode while playing!","color":"red"}
clear @s

tag @s add picking_map

item replace entity @s hotbar.3 with slime_ball[custom_data={this_map:1b},item_name={"color":"green","italic":false,"text":"Work On This Map"},lore=[{"color":"gray","italic":false,"text":"Start working on this map"}],food={nutrition:0,saturation:0,can_always_eat:true},consumable={consume_seconds:1000000,has_consume_particles:false}] 1
item replace entity @s hotbar.4 with nether_star[custom_data={return:1b},item_name={"color":"white","italic":false,"text":"Return to Lobby"},food={nutrition:0,saturation:0,can_always_eat:true},consumable={consume_seconds:1000000,has_consume_particles:false}] 1
item replace entity @s hotbar.5 with magma_cream[custom_data={next_map:1b},item_name={"color":"yellow","italic":false,"text":"Next Map Slot"},lore=[{"color":"gray","italic":false,"text":"Go to the next map slot"},{"color":"red","italic":false,"text":"Limit 3 in progress maps!"}],food={nutrition:0,saturation:0,can_always_eat:true},consumable={consume_seconds:1000000,has_consume_particles:false}] 1

scoreboard players set @s map_maker_id 0

function pctf:mode/z_map_maker/tp_loop

gamemode creative @s

attribute @s minecraft:block_interaction_range base set -1

team join lobby
tag @s add dev