###Checks for the time of day and adds requisite scores at noon###
scoreboard players add @s[tag=nitDrillStor] nitResourceSpawn 1
scoreboard players add @s[tag=nitBarnStor] nitResourceSpawn 1
scoreboard players add @s[tag=nitOutpost] nitResourceSpawn 1
scoreboard players add @s[tag=nitDoompump] nitResourceSpawn 1
scoreboard players add @s[tag=nitDragonStor,tag=nitUnlocked] nitResourceSpawn 1
scoreboard players add @s[tag=nitResourceChest,tag=nitWindmillDouble,tag=!nitFarmStor] nitResourceSpawn 1

###Performs item distribution###
execute if entity @s[scores={nitResourceSpawn=1..},tag=nitDrillStor] run loot insert ~ ~ ~ loot nitk:command/drill_daily
execute if entity @s[scores={nitResourceSpawn=1..},tag=nitBarnStor] run loot insert ~ ~ ~ loot nitk:command/barn_daily
execute if entity @s[scores={nitResourceSpawn=1..},tag=nitOutpost] run loot insert ~ ~ ~ loot nitk:command/outpost_daily
execute if entity @s[scores={nitResourceSpawn=1..},tag=nitDoompump] run loot insert ~ ~ ~ loot nitco:command/doompump_daily
execute if entity @s[scores={nitResourceSpawn=1..},tag=nitDragonStor] run loot insert ~ ~ ~ loot nitref:command/dragonologist_daily

###Decrements scores###
scoreboard players remove @s[scores={nitResourceSpawn=1..},tag=nitDrillStor] nitResourceSpawn 1
scoreboard players remove @s[scores={nitResourceSpawn=1..},tag=nitBarnStor] nitResourceSpawn 1
scoreboard players remove @s[scores={nitResourceSpawn=1..},tag=nitOutpost] nitResourceSpawn 1
scoreboard players remove @s[scores={nitResourceSpawn=1..},tag=nitDoompump] nitResourceSpawn 1
scoreboard players remove @s[scores={nitResourceSpawn=1..},tag=nitDragonStor] nitResourceSpawn 1

###Performs doubled item distribution###
execute if entity @s[scores={nitResourceSpawn=1..},tag=nitDrillStor] run loot insert ~ ~ ~ loot nitk:command/drill_daily
execute if entity @s[scores={nitResourceSpawn=1..},tag=nitBarnStor] run loot insert ~ ~ ~ loot nitk:command/barn_daily
execute if entity @s[scores={nitResourceSpawn=1..},tag=nitOutpost] run loot insert ~ ~ ~ loot nitk:command/outpost_daily
execute if entity @s[scores={nitResourceSpawn=1..},tag=nitDoompump] run loot insert ~ ~ ~ loot nitco:command/doompump_daily

###Decrements scores again###
scoreboard players remove @s[scores={nitResourceSpawn=1..},tag=nitDrillStor] nitResourceSpawn 1
scoreboard players remove @s[scores={nitResourceSpawn=1..},tag=nitBarnStor] nitResourceSpawn 1
scoreboard players remove @s[scores={nitResourceSpawn=1..},tag=nitOutpost] nitResourceSpawn 1
scoreboard players remove @s[scores={nitResourceSpawn=1..},tag=nitDoompump] nitResourceSpawn 1