mirror of
https://github.com/songoda/EpicVouchers.git
synced 2025-01-09 01:17:39 +01:00
Optimized
This commit is contained in:
parent
32f4479a09
commit
f27a76a583
@ -45,7 +45,7 @@ public class VoucherExecutor {
|
||||
} catch (Exception | Error ignore) {
|
||||
}
|
||||
|
||||
if (player.getInventory().getItem(slot) != null && !player.getInventory().getItem(slot).isSimilar(item)) {
|
||||
if(!item.isSimilar(player.getInventory().getItem(slot))) {
|
||||
duplication = true;
|
||||
}
|
||||
}
|
||||
@ -54,13 +54,12 @@ public class VoucherExecutor {
|
||||
if (manual) {
|
||||
instance.getCoolDowns().addCoolDown(player.getUniqueId(), voucher);
|
||||
if (voucher.isRemoveItem()) {
|
||||
ItemStack clone = item.clone();
|
||||
if (clone.getAmount() <= 1) {
|
||||
clone = null;
|
||||
if (item.getAmount() <= 1) {
|
||||
item = null;
|
||||
} else {
|
||||
clone.setAmount(clone.getAmount() - 1);
|
||||
item.setAmount(item.getAmount() - 1);
|
||||
}
|
||||
player.getInventory().setItem(slot, clone);
|
||||
player.getInventory().setItem(slot, item);
|
||||
player.updateInventory();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user