Man pleads guilty to terrorist charge after threatening church shooting