From cdc89ac397c4d482a8f7591c617352b1dcd33d81 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 7 Aug 2021 22:10:54 +0100 Subject: [PATCH] Fixed FastItemStack --- .../main/java/com/willfp/eco/core/fast/FastItemStack.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eco-api/src/main/java/com/willfp/eco/core/fast/FastItemStack.java b/eco-api/src/main/java/com/willfp/eco/core/fast/FastItemStack.java index b57a90c0c..218f715ea 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/fast/FastItemStack.java +++ b/eco-api/src/main/java/com/willfp/eco/core/fast/FastItemStack.java @@ -1,6 +1,7 @@ package com.willfp.eco.core.fast; import com.willfp.eco.core.Eco; +import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; @@ -8,6 +9,7 @@ import java.util.List; import java.util.Map; +import java.util.Objects; /** * FastItemStack contains methods to modify and read items faster than in default bukkit. @@ -58,7 +60,7 @@ int getLevelOnItem(@NotNull Enchantment enchantment, * @param itemStack The ItemStack. * @return The FastItemStack. */ - static FastItemStack wrap(@NotNull final ItemStack itemStack) { - return Eco.getHandler().createFastItemStack(itemStack); + static FastItemStack wrap(final ItemStack itemStack) { + return Eco.getHandler().createFastItemStack(Objects.requireNonNullElseGet(itemStack, () -> new ItemStack(Material.AIR))); } }