From dc1297306f7ce93c2464a0fd6affe27e01b768fb Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Wed, 8 Jul 2020 13:09:13 -0500 Subject: [PATCH] Fix #2 --- .../energeticstorage/gui/ESTerminalGUI.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/net/seanomik/energeticstorage/gui/ESTerminalGUI.java b/src/main/java/net/seanomik/energeticstorage/gui/ESTerminalGUI.java index 42af2be..06ef37f 100644 --- a/src/main/java/net/seanomik/energeticstorage/gui/ESTerminalGUI.java +++ b/src/main/java/net/seanomik/energeticstorage/gui/ESTerminalGUI.java @@ -330,6 +330,21 @@ public class ESTerminalGUI implements InventoryHolder, Listener { break; case INTO_HALF: + if (Utils.isItemValid(cursor)) { + // Only put one item into the system when the player right clicks with the stack. + // if we don't do this, the user can duplicate stacks of items. + ItemStack itemStack = cursor.clone(); + itemStack.setAmount(1); + if (openSystem.addItem(itemStack)) { + event.setCancelled(false); + + Bukkit.getScheduler().runTaskLater(EnergeticStorage.getPlugin(), () -> { + initializeItems(player, openSystem); + }, (long) 0.1); + } + } + + break; case INTO: if (Utils.isItemValid(cursor)) { if (openSystem.addItem(cursor)) {