Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shift support to the bank #603

Merged
merged 2 commits into from
Feb 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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