From 81e167dd4697941949ef3cce8c6c5b20dfb3d4bf Mon Sep 17 00:00:00 2001 From: Brianna O'Keefe Date: Sun, 23 Sep 2018 13:06:43 -0400 Subject: [PATCH] Hoppers modules will now correctly account for stack amounts. Module descriptions will now be displayed correctly. --- .../java/com/songoda/epichoppers/handlers/HopHandler.java | 2 +- .../epichoppers/hopper/levels/modules/ModuleAutoCrafting.java | 2 +- .../epichoppers/hopper/levels/modules/ModuleBlockBreak.java | 2 +- .../epichoppers/hopper/levels/modules/ModuleSuction.java | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/handlers/HopHandler.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/handlers/HopHandler.java index d0e27ba..3561eaa 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/handlers/HopHandler.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/handlers/HopHandler.java @@ -260,7 +260,7 @@ public class HopHandler { return 0; } - public boolean canHop(Inventory i, ItemStack item, int hop) { + private boolean canHop(Inventory i, ItemStack item, int hop) { try { if (i.firstEmpty() != -1) { return true; diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleAutoCrafting.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleAutoCrafting.java index f714e32..ddec428 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleAutoCrafting.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleAutoCrafting.java @@ -85,7 +85,7 @@ public class ModuleAutoCrafting implements Module { if (inventory.firstEmpty() != -1) return true; for (ItemStack stack : inventory.getContents()) { - if (stack.isSimilar(item) && stack.getAmount() < stack.getMaxStackSize()) { + if (stack.isSimilar(item) && (stack.getAmount() + item.getAmount()) < stack.getMaxStackSize()) { return true; } } diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleBlockBreak.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleBlockBreak.java index afa872f..f38c800 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleBlockBreak.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleBlockBreak.java @@ -61,6 +61,6 @@ public class ModuleBlockBreak implements Module { @Override public String getDescription() { - return EpicHoppersPlugin.getInstance().getLocale().getMessage("interface.hopper.blockbreak", true); + return EpicHoppersPlugin.getInstance().getLocale().getMessage("interface.hopper.blockbreak", amount); } } diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleSuction.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleSuction.java index e5bac14..09b1f16 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleSuction.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleSuction.java @@ -81,7 +81,7 @@ public class ModuleSuction implements Module { @Override public String getDescription() { - return EpicHoppersPlugin.getInstance().getLocale().getMessage("interface.hopper.suction", true); + return EpicHoppersPlugin.getInstance().getLocale().getMessage("interface.hopper.suction", amount); } private boolean canMove(Inventory inventory, ItemStack item) { @@ -89,7 +89,7 @@ public class ModuleSuction implements Module { if (inventory.firstEmpty() != -1) return true; for (ItemStack stack : inventory.getContents()) { - if (stack.isSimilar(item) && stack.getAmount() < stack.getMaxStackSize()) { + if (stack.isSimilar(item) && (stack.getAmount() + item.getAmount()) < stack.getMaxStackSize()) { return true; } }