From 45e1fee9ff445bdfb3d59b6c57a1d22e1c9e6227 Mon Sep 17 00:00:00 2001 From: Intelli Date: Wed, 21 Jul 2021 18:48:04 -0600 Subject: [PATCH] Fixed hopper transaction logging not always logging all items --- .../listener/player/HopperPullListener.java | 39 ++++--------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/src/main/java/net/coreprotect/listener/player/HopperPullListener.java b/src/main/java/net/coreprotect/listener/player/HopperPullListener.java index 99add06..4ed08e6 100644 --- a/src/main/java/net/coreprotect/listener/player/HopperPullListener.java +++ b/src/main/java/net/coreprotect/listener/player/HopperPullListener.java @@ -84,42 +84,22 @@ public final class HopperPullListener { return; } - boolean lastAborted = false; if (ConfigHandler.hopperAbort.get(loggingChestId) != null) { ConfigHandler.hopperAbort.remove(loggingChestId); - lastAborted = true; - } - - boolean mergeMoved = true; - if (lastAborted) { - for (String loggingChestIdViewer : ConfigHandler.oldContainer.keySet()) { - if (loggingChestIdViewer.equals(loggingChestId) || !loggingChestIdViewer.endsWith("." + location.getBlockX() + "." + location.getBlockY() + "." + location.getBlockZ())) { - continue; - } - - if (ConfigHandler.oldContainer.get(loggingChestIdViewer) != null) { // pending consumer item by another user - mergeMoved = false; - break; - } - } } if (!hopperTransactions) { - if (mergeMoved) { - List list = ConfigHandler.transactingChest.get(location.getWorld().getUID().toString() + "." + location.getBlockX() + "." + location.getBlockY() + "." + location.getBlockZ()); - if (list != null) { - list.add(movedItem); - } + List list = ConfigHandler.transactingChest.get(location.getWorld().getUID().toString() + "." + location.getBlockX() + "." + location.getBlockY() + "." + location.getBlockZ()); + if (list != null) { + list.add(movedItem); } return; } - if (mergeMoved) { - Location destinationLocation = destinationHolder.getInventory().getLocation(); - List list = ConfigHandler.transactingChest.get(destinationLocation.getWorld().getUID().toString() + "." + destinationLocation.getBlockX() + "." + destinationLocation.getBlockY() + "." + destinationLocation.getBlockZ()); - if (list != null) { - list.add(new ItemStack[] { null, movedItem }); - } + Location destinationLocation = destinationHolder.getInventory().getLocation(); + List list = ConfigHandler.transactingChest.get(destinationLocation.getWorld().getUID().toString() + "." + destinationLocation.getBlockX() + "." + destinationLocation.getBlockY() + "." + destinationLocation.getBlockZ()); + if (list != null) { + list.add(new ItemStack[] { null, movedItem }); } if (Config.getConfig(location.getWorld()).HOPPER_FILTER_META && !movedItem.hasItemMeta()) { @@ -136,10 +116,7 @@ public final class HopperPullListener { } } - if (mergeMoved) { - originalSource[inventoryContents.length] = movedItem; - } - + originalSource[inventoryContents.length] = movedItem; InventoryChangeListener.onInventoryInteract("#hopper", sourceInventory, originalSource, null, sourceInventory.getLocation(), true); } catch (Exception e) {