mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
Check if the item has item meta and, if it doesn't, bail out
This commit is contained in:
parent
595c43e34e
commit
52ee5f4843
@ -335,6 +335,10 @@ public class PotionConfig extends LegacyConfigLoader {
|
|||||||
* @return AlchemyPotion that corresponds to the given ItemStack.
|
* @return AlchemyPotion that corresponds to the given ItemStack.
|
||||||
*/
|
*/
|
||||||
public AlchemyPotion getPotion(ItemStack item) {
|
public AlchemyPotion getPotion(ItemStack item) {
|
||||||
|
// Fast return if the item does not have any item meta to avoid initializing an unnecessary ItemMeta instance
|
||||||
|
if (!item.hasItemMeta())
|
||||||
|
return null;
|
||||||
|
|
||||||
ItemMeta itemMeta = item.getItemMeta();
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
final List<AlchemyPotion> potionList = alchemyPotions.values()
|
final List<AlchemyPotion> potionList = alchemyPotions.values()
|
||||||
.stream()
|
.stream()
|
||||||
|
Loading…
Reference in New Issue
Block a user