Optimized

This commit is contained in:
theone1000 2019-09-16 18:52:11 -06:00
parent 32f4479a09
commit f27a76a583

View File

@ -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();
}
}