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) { } 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; duplication = true;
} }
} }
@ -54,13 +54,12 @@ public class VoucherExecutor {
if (manual) { if (manual) {
instance.getCoolDowns().addCoolDown(player.getUniqueId(), voucher); instance.getCoolDowns().addCoolDown(player.getUniqueId(), voucher);
if (voucher.isRemoveItem()) { if (voucher.isRemoveItem()) {
ItemStack clone = item.clone(); if (item.getAmount() <= 1) {
if (clone.getAmount() <= 1) { item = null;
clone = null;
} else { } else {
clone.setAmount(clone.getAmount() - 1); item.setAmount(item.getAmount() - 1);
} }
player.getInventory().setItem(slot, clone); player.getInventory().setItem(slot, item);
player.updateInventory(); player.updateInventory();
} }
} }