// Script for handling the stronhold event
// Once the player finds the stronghold, give them a custom book


// Listen for a player getting an event
PlayerEvents.advancement(event => {
    console.info(`Advancement is ${event.advancement}`)

    // Check if the advancement is the correct one
    if (event.advancement == "minecraft:story/follow_ender_eye") {
        console.info("Stronghold Event Triggered")
        console.info(`Player: ${event.player.name}`)

        event.player.give(Item.of('minecraft:written_book', '{author:".̴̡̀͗̀̂̀͐͌͐́̽̏̾̑̋̌",pages:[\'{"text":"Beneath the sunlit pixel sky,\\\\nWhere ancient echoes softly lie.\\\\nA city old, in earth entwined,\\\\nHolds the key, secrets bind."}\',\'{"text":"In caverns deep, where shadows play,\\\\nUnearth the city, come what may.\\\\nFor ancient shards, the earth bestows,\\\\nTo forge a disc, where mystery grows."}\',\'{"text":"Dig below where ores gleam bright,\\\\nA city\\\'s heart, out of sight.\\\\nIn cryptic crafting, shards align,\\\\nA disc emerges, power entwined."}\',\'{"text":"To unlock realms, where dragons soar,\\\\nForge the disc, the portal\\\'s door."}\'],title:"Read Me"}'))
        event.player.playNotifySound("block.sculk_shrieker.shriek", "ambient", 1, 1)
        //event.player.tell("Behind you")
        
        setTimeout(() => {
            event.player.tell("Look behind you")
            event.player.runCommandSilent("function fromthefog:admin/sightings/creeping")
        }, 11000)
    }
})
