execute positioned 146.53 114.00 2.05 run execute if entity @a[distance=0..3,tag=!owner,team=A] if entity @a[distance=0..3,tag=!owner,team=B] run function duop:spawnpoint1
execute positioned 146.53 114.00 2.05 run execute if entity @a[distance=0..3,tag=!owner,team=A] if entity @a[distance=0..3,tag=!owner,team=B] run tag @a[team=A,tag=!owner] add checkpoint1
execute positioned 146.53 114.00 2.05 run execute if entity @a[distance=0..3,tag=!owner,team=A] if entity @a[distance=0..3,tag=!owner,team=B] run tag @a[team=B,tag=!owner] add checkpoint1

execute positioned 270.83 105.00 3.56 run execute if entity @a[distance=0..3,tag=!owner,team=A] if entity @a[distance=0..3,tag=!owner,team=B] run function duop:spawnpoint2
execute positioned 270.83 105.00 3.56 run execute if entity @a[distance=0..3,tag=!owner,team=A] if entity @a[distance=0..3,tag=!owner,team=B] run tag @a[team=A,tag=!owner] add checkpoint2
execute positioned 270.83 105.00 3.56 run execute if entity @a[distance=0..3,tag=!owner,team=A] if entity @a[distance=0..3,tag=!owner,team=B] run tag @a[team=B,tag=!owner] add checkpoint2

execute as @a[tag=!owner] at @s if block ~ ~ ~ soul_fire run kill @s

execute positioned 0.46 101.00 0.49 run spawnpoint @a[team=B,tag=!owner,distance=0..10] -1 101 0 -20
execute positioned 0.46 101.00 0.49 run spawnpoint @a[team=A,tag=!owner,distance=0..10] -1 101 0 -160
effect give @a saturation 10 250 true

execute positioned 87.58 117.80 -2.47 run execute as @a[distance=0..10] run effect clear @s minecraft:resistance

execute positioned -44 102 0 run execute as @a[distance=0..30,tag=!owner] run spawnpoint @s 0 101 0
execute positioned -44 102 0 run execute as @a[distance=0..30,tag=!owner] run tp @s 0.50 101.00 0.50 -630.22 -14.07

#kill @e[type=item,tag=!persistente]

execute as @a[gamemode=!spectator,tag=!owner] at @s if block ~ ~-1 ~ purple_concrete_powder run team join A @s
execute as @a[gamemode=!spectator,tag=!owner] at @s if block ~ ~-1 ~ lime_concrete_powder run team join B @s
execute positioned 0.46 101.00 0.49 run execute as @a[distance=0..3] run team leave @s
execute positioned 0.46 101.00 0.49 run execute as @a[distance=0..3] run tag @s remove checkpoint1
execute positioned 0.46 101.00 0.49 run execute as @a[distance=0..3] run tag @s remove checkpoint2

execute as @a at @s unless entity @s[tag=owner] run execute if block ~ ~166 ~ air run kill @s

execute as @a at @s run execute if block ~ ~ ~ minecraft:lime_carpet run effect give @s minecraft:jump_boost 15 10
execute as @a at @s run execute unless block ~ ~ ~ lime_carpet run effect clear @s minecraft:jump_boost

execute positioned 143.44 115.45 2.16 run execute if entity @a[nbt={Inventory:[{id:"minecraft:fire_charge"}]},distance=0..3] run clone 5008 105 -16 5008 100 -11 143 113 -1
execute positioned 143.44 115.45 2.16 run execute if entity @a[nbt={Inventory:[{id:"minecraft:fire_charge"}]},distance=0..3] run particle minecraft:dust 0.902 0.000 1.000 1 143.50 116 1.95 0.3 1 1 0.5 400 normal
execute positioned 143.44 115.45 2.16 run execute if entity @a[nbt={Inventory:[{id:"minecraft:fire_charge"}]},distance=0..3] run playsound minecraft:block.portal.travel voice @a 143.50 116 1.95 2 1
execute positioned 143.44 115.45 2.16 run execute if entity @a[nbt={Inventory:[{id:"minecraft:fire_charge"}]},distance=0..3] run clear @a minecraft:fire_charge

execute positioned 259.41 107.08 3.48 run execute if entity @a[nbt={Inventory:[{id:"minecraft:ender_eye"}]},distance=0..3] run fill 260 106 4 258 106 2 minecraft:end_gateway
execute positioned 259.41 107.08 3.48 run execute if entity @a[nbt={Inventory:[{id:"minecraft:ender_eye"}]},distance=0..3] run playsound minecraft:block.end_portal.spawn master @a 259.41 107.08 3.48 3 1
execute positioned 259.41 107.08 3.48 run execute if entity @a[nbt={Inventory:[{id:"minecraft:ender_eye"}]},distance=0..3] run setblock 257 106 3 minecraft:end_portal_frame[eye=true,facing=west]
execute positioned 259.41 107.08 3.48 run execute if entity @a[nbt={Inventory:[{id:"minecraft:ender_eye"}]},distance=0..3] run clear @a

execute if block 87 117 -5 water run fill 90 117 -6 84 117 0 air

scoreboard objectives add muertes deathCount
execute as @a[scores={muertes=1..}] run function duop:reset
execute as @a[scores={muertes=1..}] run scoreboard players add total attempts 1
execute as @a[scores={muertes=1..}] run kill @a[scores={muertes=0},tag=!owner]
scoreboard players set @a muertes 0
scoreboard players reset att attempts

scoreboard objectives add attempts dummy

execute positioned 259.68 107.52 3.58 run execute as @a[distance=0..5] at @s run execute if block ~ ~ ~ minecraft:end_gateway run playsound minecraft:block.portal.travel voice @s ~ ~ ~ 10
execute positioned 259.68 107.52 3.58 run execute as @a[distance=0..5] at @s run execute if block ~ ~ ~ minecraft:end_gateway run clear @s
execute positioned 259.68 107.52 3.58 run execute as @a[distance=0..5] at @s run execute if block ~ ~ ~ minecraft:end_gateway run spreadplayers 270.56 3.46 1 1 false @s

execute if block 282 109 12 minecraft:magenta_stained_glass run setblock 276 105 -2 minecraft:redstone_block
execute if block 285 112 12 minecraft:magenta_stained_glass run setblock 276 107 -2 minecraft:redstone_block
execute if block 288 115 12 minecraft:magenta_stained_glass run setblock 276 111 -2 minecraft:redstone_block

execute if block 370 100 -3 minecraft:polished_blackstone_pressure_plate[powered=true] if block 370 100 3 minecraft:polished_blackstone_pressure_plate[powered=true] run function duop:end_animation

execute as @e[type=minecraft:arrow ] at @s run execute if block ~1 ~ ~ minecraft:gold_block run setblock ~1 ~ ~ air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~1 ~ ~ minecraft:gold_block run setblock ~-1 ~ ~ air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~ ~ ~1 minecraft:gold_block run setblock ~ ~ ~1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~ ~ ~-1 minecraft:gold_block run setblock ~ ~ ~-1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~1 ~ ~1 minecraft:gold_block run setblock ~1 ~ ~1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~-1 ~ ~-1 minecraft:gold_block run setblock ~-1 ~ ~-1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~1 ~ ~-1 minecraft:gold_block run setblock ~1 ~ ~-1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~-1 ~ ~1 minecraft:gold_block run setblock ~-1 ~ ~1 air destroy

execute as @e[type=minecraft:arrow ] at @s run execute if block ~1 ~ ~ minecraft:gold_block run setblock ~1 ~1 ~ air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~1 ~ ~ minecraft:gold_block run setblock ~-1 ~1 ~ air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~ ~ ~1 minecraft:gold_block run setblock ~ ~1 ~1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~ ~ ~-1 minecraft:gold_block run setblock ~ ~1 ~-1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~1 ~ ~1 minecraft:gold_block run setblock ~1 ~1 ~1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~-1 ~ ~-1 minecraft:gold_block run setblock ~-1 ~1 ~-1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~1 ~ ~-1 minecraft:gold_block run setblock ~1 ~1 ~-1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~-1 ~ ~1 minecraft:gold_block run setblock ~-1 ~1 ~1 air destroy

execute as @e[type=minecraft:arrow ] at @s run execute if block ~1 ~ ~ minecraft:gold_block run setblock ~1 ~-1 ~ air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~1 ~ ~ minecraft:gold_block run setblock ~-1 ~-1 ~ air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~ ~ ~1 minecraft:gold_block run setblock ~ ~-1 ~1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~ ~ ~-1 minecraft:gold_block run setblock ~ ~-1 ~-1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~1 ~ ~1 minecraft:gold_block run setblock ~1 ~-1 ~1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~-1 ~ ~-1 minecraft:gold_block run setblock ~-1 ~-1 ~-1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~1 ~ ~-1 minecraft:gold_block run setblock ~1 ~-1 ~-1 air destroy
execute as @e[type=minecraft:arrow ] at @s run execute if block ~-1 ~ ~1 minecraft:gold_block run setblock ~-1 ~-1 ~1 air destroy

gamemode adventure @a[tag=!owner]