Skip to content

Commit

Permalink
did a lil' refactorin (removed redundancies)
Browse files Browse the repository at this point in the history
  • Loading branch information
sh0inx committed May 19, 2024
1 parent c6c232c commit 9ec2a18
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ public void onClick(PlayerInteractEvent event) {
User user = IridiumSkyblock.getInstance().getUserManager().getUser(player);
ItemStack itemInHand = player.getInventory().getItemInMainHand();

int crystalAmount = IridiumSkyblock.getInstance().getIslandManager().getIslandCrystals(itemInHand);
if((event.getAction() == Action.RIGHT_CLICK_AIR
|| event.getAction() == Action.RIGHT_CLICK_BLOCK)
&& IridiumSkyblock.getInstance().getIslandManager().getIslandCrystals(itemInHand) > 0) {
&& crystalAmount > 0) {

int crystalAmount = IridiumSkyblock.getInstance().getIslandManager().getIslandCrystals(itemInHand);
if (IridiumSkyblock.getInstance().getCommandManager().executeCommand(event.getPlayer(), IridiumSkyblock.getInstance().getCommands().depositCommand, new String[] {IridiumSkyblock.getInstance().getBankItems().crystalsBankItem.getName(), String.valueOf(crystalAmount)})) {
itemInHand.setAmount(0);
event.setCancelled(true);
return;
}
Expand Down

0 comments on commit 9ec2a18

Please sign in to comment.