#!tag "bs.load:status"

{% include 'bookshelf/header.jinja' %}
# Return early to ensure code runs only on the latest available version
execute unless score $bs.load.major load.status matches {{ version.major }} run return 0
execute unless score $bs.load.minor load.status matches {{ version.minor }} run return 0
execute unless score $bs.load.patch load.status matches {{ version.patch }} run return 0

execute unless function #bs.load:process/validate run return fail

data modify storage bs:ctx _ set value []
data modify storage bs:ctx _ append from storage bs:data load.modules[{enabled:1b}]
data modify storage bs:data load.status set value []
function bs.load:v{{ version.major }}.{{ version.minor }}.{{ version.patch }}/status/module

tellraw @a [{text:"\n✔ ",color:"#4CCB5E",underlined:true},{text:"BOOKSHELF",bold:true},{text:" • Modules Loaded Successfully\n"}]
tellraw @a [{text:"◇ Loaded Modules: ",color:"#F3B512"},{text:"\n • ",color:"#CCCCCC"},{type:"nbt",storage:"bs:data",nbt:"load.status[]",color:"#CCCCCC",separator:"\n • ",interpret:true},"\n"]
return 1
