execute if entity @s[tag=nitSiteEast] run place template nitk:town/bank ~1 ~-3 ~-7

execute if entity @s[tag=nitSiteWest] run place template nitk:town/bank ~-1 ~-3 ~7 180

execute if entity @s[tag=nitSiteNorth] run place template nitk:town/bank ~-7 ~-3 ~-1 counterclockwise_90

execute if entity @s[tag=nitSiteSouth] run place template nitk:town/bank ~7 ~-3 ~1 clockwise_90

execute as @e[tag=nitBanker,limit=1,sort=nearest] at @s unless entity @e[tag=nitKB,distance=..2] run summon villager ~ ~ ~ {VillagerData:{profession:"librarian",level:5,type:"plains"},Invulnerable:1,PersistenceRequired:1,NoAI:1,CustomName:'{"text":"Banker"}',Offers:{Recipes:[{buy:{id:"feather",Count:1},sell:{id:"written_book",Count:1},rewardExp:0b,maxUses:9999999},{buy:{id:"stone",Count:64},buyB:{id:"stone",Count:64},sell:{id:"paper",Count:2,tag:{nitk_bankNote:1b,HideFlags:1,display:{Lore:['{"text":"A receipt for resources","color":"gray","italic":false}','{"text":"to be used in Banking,","color":"gray","italic":false}','{"text":"and to upgrade some sites.","color":"gray","italic":false}'],Name:'{"text":"Bank Note","color":"green","italic":false}'},Enchantments:[{id:"minecraft:protection",lvl:0}]}},rewardExp:0b,maxUses:9999999},{buy:{id:"oak_log",Count:64},buyB:{id:"oak_log",Count:64},sell:{id:"paper",Count:2,tag:{nitk_bankNote:1b,HideFlags:1,display:{Lore:['{"text":"A receipt for resources","color":"gray","italic":false}','{"text":"to be used in Banking,","color":"gray","italic":false}','{"text":"and to upgrade some sites.","color":"gray","italic":false}'],Name:'{"text":"Bank Note","color":"green","italic":false}'},Enchantments:[{id:"minecraft:protection",lvl:0}]}},rewardExp:0b,maxUses:9999999},{buy:{id:"gold_ingot",Count:64},buyB:{id:"gold_ingot",Count:64},sell:{id:"paper",Count:1,tag:{nitk_bankNote:1b,HideFlags:1,display:{Lore:['{"text":"A receipt for resources","color":"gray","italic":false}','{"text":"to be used in Banking,","color":"gray","italic":false}','{"text":"and to upgrade some sites.","color":"gray","italic":false}'],Name:'{"text":"Bank Note","color":"green","italic":false}'},Enchantments:[{id:"minecraft:protection",lvl:0}]}},rewardExp:0b,maxUses:9999999}]},Tags:[nitCitizen,nitEntity,nitKB,smithed.entity,smithed.strict]}
scoreboard players operation @e[tag=nitKB,limit=1,sort=nearest] nitID = @e[tag=nitKTP,limit=1,sort=nearest] nitID
function nitk:debug/update_all

function nitk:siteplanner/new_sites_check
function nitk:siteplanner/attacks_check
advancement grant @a[distance=..20] only nitk:nitk/complete_town build-bank