Updated null checks in MetadataStoreBase. Fixes BUKKIT-1412

Previously, the method could be called with a null MetadataStore and stored.
In later execution null pointer exceptions would be generated when checking
for the plugin that the set Metadata belongs to.

Additionally, places where a plugin is referenced will now throw an
IllegalArgumentException if specified plugin is null. Using null would be an
obvious logical flaw, and in some cases produce additional exceptions later
in execution.

By: mbax <github@phozop.net>
This commit is contained in:
Bukkit/Spigot
2012-07-16 15:05:51 -04:00
parent 29a5295348
commit 977cc8a31c
4 changed files with 14 additions and 5 deletions

View File

@@ -62,7 +62,7 @@ public interface MetadataValue {
/**
* Returns the {@link Plugin} that created this metadata item.
*
* @return the plugin that owns this metadata value.
* @return the plugin that owns this metadata value. This should never be null.
*/
public Plugin getOwningPlugin();