PlayerEvents.tick(event => {
    const player = event.player
    if (player.level.isClientSide()) return
    if (player.age % 20 !== 0) return

    const purchases = {
        //mods
        "purchase_trashcans": "Trash Cans §dMod",
        "purchase_elevators": "Elevators §dMod",
        "purchase_botany_pots": "Botany Pots §dMod",
        "purchase_botany_pots_tiers": "Botany Pots Tiers §dMod",
        "purchase_waystones": "Waystones §dMod",
        "purchase_natures_compass": "Nature's Compass §dMod",
        "purchase_explorers_compass": "Explorer's Compass §dMod",
        "purchase_storage_drawers": "Storage Drawers §dMod",
        "purchase_sophisticated_backpacks": "Sophisticated Backpack §dMods",
        "purchase_vein_mining": "Vein Mining §dEnchantment",
        "purchase_construction_wands": "Construction Wands §dMod",
        "purchase_toms_storage": "Tom's Storage §dMod",
        "purchase_crafting_station": "Crafting Station §dMod",
        "purchase_farmers_delight": "Farmer's Delight §dMod",
        "purchase_torch_master": "Torchmaster §dMod",
        "purchase_biome_beans": "Biome Beans §dMod",
        "purchase_paxels": "Paxels §dMod",
        "purchase_simple_magnets": "Simple Magnets §dMod",
        "purchase_xp_book": "XP Tome §dMod",
        //vanilla
        "purchase_beds": "Beds §fcan now be used",
        "purchase_basic_storage": "Barrels §fcan now be used",
        "purchase_advanced_storage": "Chests §fcan now be used",
        "purchase_hay_block": "Hay Blocks §fcan now be used",
        "purchase_slime_block": "Slime Blocks §fcan now be used",
        "purchase_composter": "Composters §fcan now be used",
        "purchase_flint_and_steel": "Flint & Steel §fcan now be used",
        "purchase_soul_campfire": "Soul Campfires §fcan now be used",
        "purchase_furnace": "Furnaces & Blast Furnaces §fcan now be used",
        "purchase_end_portal_frame": "End Portal Frames §fcan now be used"
    }

    const data = player.persistentData

    for (const stage in purchases) {
        if (!player.stages.has(stage)) continue
        if (data.getBoolean(`announced_${stage}`)) continue

        data.putBoolean(`announced_${stage}`, true)

        const name = purchases[stage]

        player.server.runCommandSilent(`tellraw ${player.username} [{"text":"Unlocked: ","color":"green"},{"text":"${name}","color":"gold"}]`)
        player.server.runCommandSilent(`execute at ${player.username} run playsound minecraft:entity.experience_orb.pickup master ${player.username} ~ ~ ~ 0.65 0.8`)

    }
})