Centralise detection/handling of different types of plugins.

+review REVIEW-5214