Fixed hopper transaction logging not always logging all items

This commit is contained in:
Intelli 2021-07-21 18:48:04 -06:00
parent aa55472c1a
commit 45e1fee9ff

View File

@ -84,43 +84,23 @@ public final class HopperPullListener {
return; return;
} }
boolean lastAborted = false;
if (ConfigHandler.hopperAbort.get(loggingChestId) != null) { if (ConfigHandler.hopperAbort.get(loggingChestId) != null) {
ConfigHandler.hopperAbort.remove(loggingChestId); 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 (!hopperTransactions) {
if (mergeMoved) {
List<Object> list = ConfigHandler.transactingChest.get(location.getWorld().getUID().toString() + "." + location.getBlockX() + "." + location.getBlockY() + "." + location.getBlockZ()); List<Object> list = ConfigHandler.transactingChest.get(location.getWorld().getUID().toString() + "." + location.getBlockX() + "." + location.getBlockY() + "." + location.getBlockZ());
if (list != null) { if (list != null) {
list.add(movedItem); list.add(movedItem);
} }
}
return; return;
} }
if (mergeMoved) {
Location destinationLocation = destinationHolder.getInventory().getLocation(); Location destinationLocation = destinationHolder.getInventory().getLocation();
List<Object> list = ConfigHandler.transactingChest.get(destinationLocation.getWorld().getUID().toString() + "." + destinationLocation.getBlockX() + "." + destinationLocation.getBlockY() + "." + destinationLocation.getBlockZ()); List<Object> list = ConfigHandler.transactingChest.get(destinationLocation.getWorld().getUID().toString() + "." + destinationLocation.getBlockX() + "." + destinationLocation.getBlockY() + "." + destinationLocation.getBlockZ());
if (list != null) { if (list != null) {
list.add(new ItemStack[] { null, movedItem }); list.add(new ItemStack[] { null, movedItem });
} }
}
if (Config.getConfig(location.getWorld()).HOPPER_FILTER_META && !movedItem.hasItemMeta()) { if (Config.getConfig(location.getWorld()).HOPPER_FILTER_META && !movedItem.hasItemMeta()) {
return; return;
@ -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); InventoryChangeListener.onInventoryInteract("#hopper", sourceInventory, originalSource, null, sourceInventory.getLocation(), true);
} }
catch (Exception e) { catch (Exception e) {