From bb79caf8d3e1025d373b49bcd44aa34115d46f39 Mon Sep 17 00:00:00 2001 From: ceze88 Date: Wed, 20 Oct 2021 18:55:08 +0200 Subject: [PATCH] Fix null console spam --- .../minecraft/chests/listeners/HopperListener.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/listeners/HopperListener.java b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/listeners/HopperListener.java index 3988829..1153123 100644 --- a/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/listeners/HopperListener.java +++ b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/listeners/HopperListener.java @@ -53,13 +53,15 @@ public class HopperListener implements Listener { // Loop over the inventory until next item is found, if no item found return. while (true) { + if (index >= event.getSource().getSize()) { + return; + } + ItemStack item = event.getSource().getItem(index++); - if (item == null) + if (item == null) { continue; - - if (index >= event.getSource().getSize()) - return; + } if (isFilteredItem.apply(item)) { Utils.hopperMove(event.getSource(), item, hopperAmount, event.getDestination()); @@ -67,7 +69,6 @@ public class HopperListener implements Listener { } } } - } }