Check null before grabbing owning plugin - fixes BUKKIT-3987

The null validation check comes after the owning plugin is extracted from it, resulting in a possible NPE if a null value is passed to the method.

The issue:

A validation check is called to make sure that the metadata value passed in is not null. However, another call, which gets the owning plugin of the metadata value, gets called before this validation check is called, resulting in an NPE if the value passed into the method is null.

Bukkit Ticket:

BUKKIT-3987: https://bukkit.atlassian.net/browse/BUKKIT-3987