Skip to content

Commit 600825c

Browse files
committed
Make sure the message not get sent on 0 or less items like air
1 parent 4682013 commit 600825c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Menu Library/src/main/java/org/broken/arrow/library/menu/CheckItemsInsideMenu.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ public void getInventoryItems(final Map<Integer, ItemStack> items, final int slo
238238
*/
239239
private Map<Integer, ItemStack> addToMuchItems(final Map<Integer, ItemStack> items, final Player player, final ItemStack[] itemStacks, final Location location) {
240240
final Map<Integer, ItemStack> itemStacksNoDoubleEntity = new HashMap<>();
241-
final Map<ItemStack, Integer> cachedDuplicatedItems = new HashMap<>();
242241
final Set<ItemStack> set = new HashSet<>();
243242
this.sendMsgPlayer = false;
244243
for (final Map.Entry<Integer, ItemStack> entity : items.entrySet()) {
@@ -284,6 +283,8 @@ private void addItemsBackToPlayer(final Location location) {
284283
for (final Entry<ItemStack, Integer> items : duplicateStacks.entrySet()) {
285284
final ItemStack itemStack = items.getKey();
286285
final int amount = items.getValue();
286+
if (amount <= 0 || itemStack == null || itemStack.getType() == Material.AIR)
287+
continue;
287288

288289
itemStack.setAmount(amount);
289290
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(mapEntry.getKey());

0 commit comments

Comments
 (0)