CobblemonEvents.afterSpawnedPokemon(event => {
    let pokemon = event.pokemon

    if (!pokemon) return

    let isShiny = pokemon.shiny
    let species = pokemon.species.name

    // Legendary check (varies slightly by version)
    let isLegendary = pokemon.isLegendary || pokemon.form?.isLegendary

    if (isShiny || isLegendary) {
        event.server.runCommandSilent(
            `/tellraw @a {"text":"✨ Rare Pokémon spawned: ${species}","color":"gold"}`
        )
    }
})