Fixed occasional NullPointerException while processing hopper transactions (fixes #539)

This commit is contained in:
Intelli 2024-05-08 13:18:42 -06:00
parent 704f0aaf9b
commit 346b4b8b20

View File

@ -1,7 +1,9 @@
package net.coreprotect.consumer.process; package net.coreprotect.consumer.process;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -46,8 +48,9 @@ class ContainerTransactionProcess {
} }
} }
else if (loggingChestId.startsWith("#hopper")) { else if (loggingChestId.startsWith("#hopper")) {
if (force_size == 0 && ConfigHandler.oldContainer.get(loggingChestId).size() == 1 && ConfigHandler.transactingChest.get(transactingChestId).isEmpty()) { List<Object> transactingChest = ConfigHandler.transactingChest.get(transactingChestId);
int loopCount = ConfigHandler.loggingChest.get(loggingChestId); if (force_size == 0 && ConfigHandler.oldContainer.getOrDefault(loggingChestId, Collections.synchronizedList(new ArrayList<>())).size() == 1 && transactingChest != null && transactingChest.isEmpty()) {
int loopCount = ConfigHandler.loggingChest.getOrDefault(loggingChestId, 0);
int maxInventorySize = (99 * 54); int maxInventorySize = (99 * 54);
try { try {
Inventory checkInventory = (Inventory) inventory; Inventory checkInventory = (Inventory) inventory;