Skip to content

Commit

Permalink
Single Loop
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueDarkLord committed Mar 9, 2024
1 parent 4ae5914 commit 7fe6077
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,21 @@ public void onInventoryClick(InventoryClickEvent event) {
int total = 0;
boolean toggle = false;

for (int slot : this.slots.keySet()) {
ItemStack reward = inventory.getItem(this.slots.get(slot));
for (Map.Entry<Integer, Integer> slot : this.slots.entrySet()) {
ItemStack reward = inventory.getItem(slot.getValue());

if (reward != null) {
if (Currency.getCurrency(this.configuration.getString("Settings.Currency")) == Currency.VAULT) {
total = TinkererManager.getTotalXP(inventory.getItem(slot), this.configuration);
total = TinkererManager.getTotalXP(inventory.getItem(slot.getKey()), this.configuration);
} else {
bottomInventory.addItem(reward).values().forEach(item -> player.getWorld().dropItem(player.getLocation(), item));
}

toggle = true;
}

inventory.setItem(slot, new ItemStack(Material.AIR));
inventory.setItem(this.slots.get(slot), new ItemStack(Material.AIR));
inventory.setItem(slot.getKey(), new ItemStack(Material.AIR));
inventory.setItem(slot.getValue(), new ItemStack(Material.AIR));
}

player.closeInventory();
Expand Down

0 comments on commit 7fe6077

Please sign in to comment.