// Priority: 10

BlockEvents.broken(event => {
    const { block, player, server } = event
    
    if (block.id.contains('spawner')) {
        if (player && !player.isCreative()) {
            
            // 1. Play Sound (Vanilla Command)
            server.runCommandSilent(`execute at ${player.uuid} run playsound minecraft:block.anvil.place blocks @p ~ ~ ~ 0.6 1.8`)
            
            // 2. Show Subtitle (Action Bar)
            // Using the vanilla 'title' command for the most reliable centered look
            server.runCommandSilent(`title ${player.username} actionbar {"text":"The cage is bound; survive the trial to break the seal.","color":"gold"}`)
            
            // 3. Recoil & Particles
            player.attack(0.5) 
            server.runCommandSilent(`execute at ${block.x} ${block.y} ${block.z} run particle minecraft:enchant ~0.5 ~0.5 ~0.5 0.2 0.2 0.2 0.1 15`)

            // 4. Cancel the break
            event.cancel()
        }
    }
})