execute unless entity @e[type=villager,tag=nitKTP,distance=..2] run summon villager ~ ~ ~ {VillagerData:{profession:cartographer,level:4,type:"plains"},Invulnerable:1,PersistenceRequired:1,NoAI:1,CustomName:'{"text":"Town Planner"}',Offers:{Recipes:[{buy:{id:"minecraft:feather",Count:1},sell:{id:"minecraft:written_book",Count:1},maxUses:9999999},{buy:{id:gold_ingot,Count:4},sell:{id:"minecraft:paper",Count:1b,tag:{nitk_buildingPermit:1b,HideFlags:1,display:{Lore:['{"text":"The final ingredient","color":"gray","italic":false}','{"text":"in new town structures.","color":"gray","italic":false}'],Name:'{"text":"Building Permit","color":"blue","italic":false}'},Enchantments:[{id:"minecraft:protection",lvl:0}]}},maxUses:9999999},{buy:{id:gold_ingot,Count:24},buyB:{id:"minecraft:paper",Count:1b,tag:{nitk_buildingPermit:1b,HideFlags:1,display:{Lore:['{"text":"The final ingredient","color":"gray","italic":false}','{"text":"in new town structures.","color":"gray","italic":false}'],Name:'{"text":"Building Permit","color":"blue","italic":false}'},Enchantments:[{id:"minecraft:protection",lvl:0}]}},sell:{id:"minecraft:paper",Count:6b,tag:{nitk_castlePermit:1b,HideFlags:1,display:{Lore:['{"text":"For preparing sites","color":"gray","italic":false}','{"text":"for a unified fortress.","color":"gray","italic":false}'],Name:'{"text":"Castle Permit","color":"blue","italic":false}'},Enchantments:[{id:"minecraft:protection",lvl:0}]}},maxUses:1}]},Tags:[nitCitizen,nitKTP,smithed.entity,smithed.strict,nitEntity]}
scoreboard players operation @e[type=villager,tag=nitKTP,limit=1,sort=nearest] nitID = @s nitID
function nitk:debug/update_all