mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-01 05:04:43 +02:00
Check if the item has item meta and, if it doesn't, bail out
This commit is contained in:
@ -335,6 +335,10 @@ public class PotionConfig extends LegacyConfigLoader {
|
||||
* @return AlchemyPotion that corresponds to the given ItemStack.
|
||||
*/
|
||||
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();
|
||||
final List<AlchemyPotion> potionList = alchemyPotions.values()
|
||||
.stream()
|
||||
|
Reference in New Issue
Block a user