Package xyz.xenondevs.invui.util
Class ItemUtils
java.lang.Object
xyz.xenondevs.invui.util.ItemUtils
-
Constructor Summary
-
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 boolean
isEmpty
(@Nullable org.bukkit.inventory.ItemStack itemStack) Checks whether the givenItemStack
is empty.static @Nullable org.bukkit.inventory.ItemStack
takeUnlessEmpty
(@Nullable org.bukkit.inventory.ItemStack itemStack) Checks whether the givenItemStack
is 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 givenItemStack
is empty.An
ItemStack
is considered empty if it is null, air, or has an amount of or less than 0.- Parameters:
itemStack
- TheItemStack
to check.- Returns:
- Whether the
ItemStack
is empty.
-
takeUnlessEmpty
@Nullable public static @Nullable org.bukkit.inventory.ItemStack takeUnlessEmpty(@Nullable @Nullable org.bukkit.inventory.ItemStack itemStack) Checks whether the givenItemStack
is empty and returns null if it is.- Parameters:
itemStack
- TheItemStack
to check.- Returns:
- The
ItemStack
if 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.
-