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:
@@ -13,6 +13,7 @@ public interface Metadatable {
|
||||
*
|
||||
* @param metadataKey A unique key to identify this metadata.
|
||||
* @param newMetadataValue The metadata value to apply.
|
||||
* @throws IllegalArgumentException If value is null, or the owning plugin is null
|
||||
*/
|
||||
public void setMetadata(String metadataKey, MetadataValue newMetadataValue);
|
||||
|
||||
@@ -37,6 +38,7 @@ public interface Metadatable {
|
||||
*
|
||||
* @param metadataKey the unique metadata key identifying the metadata to remove.
|
||||
* @param owningPlugin This plugin's metadata value will be removed. All other values will be left untouched.
|
||||
* @throws IllegalArgumentException If plugin is null
|
||||
*/
|
||||
public void removeMetadata(String metadataKey, Plugin owningPlugin);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user