Skip to content

Commit 28a09dc

Browse files
Optimize ItemUtils#isEmpty
Use existing ItemStack#isEmpty instead of resolving Material (HashMap lookup)
1 parent e6487dd commit 28a09dc

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

invui/src/main/java/xyz/xenondevs/invui/util/ItemUtils.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ private ItemUtils() {}
2929
* @return Whether the {@link ItemStack} is empty.
3030
*/
3131
public static boolean isEmpty(@Nullable ItemStack itemStack) {
32-
if (itemStack == null || itemStack.getAmount() <= 0)
33-
return true;
34-
35-
Material type = itemStack.getType();
36-
return type == Material.AIR || type == Material.CAVE_AIR || type == Material.VOID_AIR;
32+
return itemStack == null || itemStack.isEmpty();
3733
}
3834

3935
/**

0 commit comments

Comments
 (0)