Skip to content

Commit

Permalink
Add shift support to the bank (#603)
Browse files Browse the repository at this point in the history
* Add shift support to the bank

* Fix formatting
  • Loading branch information
dlsf authored Feb 7, 2022
1 parent 75271e2 commit 83bcad1
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/main/java/com/iridium/iridiumskyblock/gui/IslandBankGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,26 @@ public void addContent(Inventory inventory) {
*/
@Override
public void onInventoryClick(InventoryClickEvent event) {
Optional<BankItem> bankItem = IridiumSkyblock.getInstance().getBankItemList().stream().filter(item -> item.getItem().slot == event.getSlot()).findFirst();
if (!bankItem.isPresent()) return;
Optional<BankItem> bankItemOptional = IridiumSkyblock.getInstance().getBankItemList().stream()
.filter(item -> item.getItem().slot == event.getSlot())
.findFirst();
if (!bankItemOptional.isPresent()) return;

BankItem bankItem = bankItemOptional.get();
IslandBank islandBank = IridiumSkyblock.getInstance().getIslandManager().getIslandBank(getIsland(), bankItem);

switch (event.getClick()) {
case LEFT:
IridiumSkyblock.getInstance().getCommands().withdrawCommand.execute(event.getWhoClicked(), new String[]{"", bankItem.get().getName(), String.valueOf(bankItem.get().getDefaultAmount())});
IridiumSkyblock.getInstance().getCommands().withdrawCommand.execute(event.getWhoClicked(), new String[]{"", bankItem.getName(), String.valueOf(bankItem.getDefaultAmount())});
break;
case SHIFT_LEFT:
IridiumSkyblock.getInstance().getCommands().withdrawCommand.execute(event.getWhoClicked(), new String[]{"", bankItem.getName(), String.valueOf(islandBank.getNumber())});
break;
case RIGHT:
IridiumSkyblock.getInstance().getCommands().depositCommand.execute(event.getWhoClicked(), new String[]{"", bankItem.get().getName(), String.valueOf(bankItem.get().getDefaultAmount())});
IridiumSkyblock.getInstance().getCommands().depositCommand.execute(event.getWhoClicked(), new String[]{"", bankItem.getName(), String.valueOf(bankItem.getDefaultAmount())});
break;
case SHIFT_RIGHT:
IridiumSkyblock.getInstance().getCommands().depositCommand.execute(event.getWhoClicked(), new String[]{"", bankItem.getName(), String.valueOf(islandBank.getNumber())});
break;
}

Expand Down

0 comments on commit 83bcad1

Please sign in to comment.