Improved hopper logging to prevent infinite attempts on failed pushes

E.g. when a hopper is repeatedly trying to push into a smoker, but no items are actually being transferred
This commit is contained in:
Intelli 2024-05-07 14:08:59 -06:00
parent 6023c21ba9
commit 5426e69fb8
4 changed files with 53 additions and 1 deletions

View file

@ -161,6 +161,7 @@ public class ContainerLogger extends Queue {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null) {
return;
}
boolean success = false;
int slot = 0;
for (ItemStack item : items) {
if (item != null) {
@ -190,10 +191,17 @@ public class ContainerLogger extends Queue {
int data = 0;
int amount = item.getAmount();
ContainerStatement.insert(preparedStmt, batchCount, time, userId, wid, x, y, z, typeId, data, amount, metadata, action, 0);
success = true;
}
}
slot++;
}
if (success && user.equals("#hopper")) {
String hopperPush = "#hopper-push." + location.getBlockX() + "." + location.getBlockY() + "." + location.getBlockZ();
ConfigHandler.hopperSuccess.remove(hopperPush);
ConfigHandler.hopperAbort.remove(hopperPush);
}
}
catch (Exception e) {
e.printStackTrace();