#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#
#    This function has been created by Skilendarz Group.
#             https://skilendarz.com
#
#      GIVE MAP MAKERS THE CREDIT THEY DESERVE!
#             COPYING IS PROHIBITED!
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#Achievements
advancement grant @a[scores={wins=1..}] only f:victory_royal
advancement grant @a[scores={wins=10..}] only f:veteran
advancement grant @a[tag=win,tag=!died] only f:invulnerable
advancement grant @a[tag=win,tag=!died,scores={game_kills=5..}] only f:plot_armor
advancement grant @a[scores={pumpkins=50..}] only f:pumpkinator

#Scores
scoreboard players set @a pumpkin_count 0
scoreboard players set @a game_kills 0
scoreboard players set missile time 0
scoreboard players set @a kill-timer 0

scoreboard players reset $team_blue
scoreboard players reset $team_red
scoreboard players reset $team_green
scoreboard players reset $team_yellow
scoreboard players reset @e[tag=team_stand]

scoreboard objectives setdisplay sidebar.team.blue
scoreboard objectives setdisplay sidebar.team.dark_red
scoreboard objectives setdisplay sidebar.team.dark_green
scoreboard objectives setdisplay sidebar.team.yellow
scoreboard objectives setdisplay sidebar.team.dark_gray
scoreboard objectives setdisplay sidebar.team.aqua
scoreboard objectives setdisplay sidebar.team.dark_purple

#Entities
kill @e[tag=pumpkin]
kill @e[tag=powerup]
kill @e[tag=dab]
kill @e[type=fireball]
kill @e[tag=hearts]
kill @e[tag=win6]
kill @e[tag=itemwin]
kill @e[tag=pumpkin_win_effect]
kill @e[tag=minigun]
tag @e remove summon
tag @e[tag=team_stand] remove win
bossbar set minecraft:display visible false
bossbar set minecraft:powerup1 players
bossbar set minecraft:powerup2 players
bossbar set minecraft:powerup3 players
bossbar set minecraft:powerup4 players

execute at @e[tag=gold] run setblock ~ ~ ~ minecraft:red_nether_bricks

function f:game/gravestone
execute at @e[tag=gravestone] run data merge block ~ ~ ~ {Text2:'{"text":""}'}
kill @e[tag=gravestone]

team leave @a
tag @a remove original_seeker
tag @a remove player
tag @a remove win
tag @a remove died
function f:lobby/end-fw
scoreboard players set $core main 0
execute as @a run function f:lobby/join

fill -17 153 33 -17 153 35 minecraft:spruce_fence_gate[facing=east]
fill 78 153 37 80 153 37 minecraft:spruce_fence_gate[facing=south]
fill 76 153 135 76 153 137 minecraft:spruce_fence_gate[facing=east]
fill -19 153 133 -21 153 133 minecraft:spruce_fence_gate[facing=south]