Skip to content

Commit

Permalink
Fixed FastItemStack
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Aug 7, 2021
1 parent e758ceb commit cdc89ac
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
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;
import org.jetbrains.annotations.Nullable;

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.
Expand Down Expand Up @@ -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)));
}
}

0 comments on commit cdc89ac

Please sign in to comment.