Package xyz.xenondevs.invui.util
Class ItemUtils
java.lang.Object
xyz.xenondevs.invui.util.ItemUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable org.bukkit.inventory.ItemStack @NotNull []clone(@Nullable org.bukkit.inventory.ItemStack @NotNull [] array) Creates a new array with clones of the givenItemStacks.static booleanisEmpty(@Nullable org.bukkit.inventory.ItemStack itemStack) Checks whether the givenItemStackis empty.static @Nullable org.bukkit.inventory.ItemStacktakeUnlessEmpty(@Nullable org.bukkit.inventory.ItemStack itemStack) Checks whether the givenItemStackis empty and returns null if it is.
-
Constructor Details
-
ItemUtils
public ItemUtils()
-
-
Method Details
-
isEmpty
public static boolean isEmpty(@Nullable @Nullable org.bukkit.inventory.ItemStack itemStack) Checks whether the givenItemStackis empty.An
ItemStackis considered empty if it is null, air, or has an amount of or less than 0.- Parameters:
itemStack- TheItemStackto check.- Returns:
- Whether the
ItemStackis empty.
-
takeUnlessEmpty
@Nullable public static @Nullable org.bukkit.inventory.ItemStack takeUnlessEmpty(@Nullable @Nullable org.bukkit.inventory.ItemStack itemStack) Checks whether the givenItemStackis empty and returns null if it is.- Parameters:
itemStack- TheItemStackto check.- Returns:
- The
ItemStackif it is not empty or null otherwise.
-
clone
@Nullable public static @Nullable org.bukkit.inventory.ItemStack @NotNull [] clone(@Nullable @Nullable org.bukkit.inventory.ItemStack @NotNull [] array) Creates a new array with clones of the givenItemStacks.- Parameters:
array- The array to clone.- Returns:
- The cloned array.
-