From c9242ba837658e64b75f70f261e9a0342e1041ba Mon Sep 17 00:00:00 2001 From: Ryder Belserion Date: Thu, 11 Jul 2024 21:36:32 -0400 Subject: [PATCH] don't need to unnecessary item meta edits for setting the max stack size I was fixing the issue in the wrong place. --- .../crazycrates/api/objects/Crate.java | 50 +++---------------- 1 file changed, 6 insertions(+), 44 deletions(-) diff --git a/src/main/java/com/badbones69/crazycrates/api/objects/Crate.java b/src/main/java/com/badbones69/crazycrates/api/objects/Crate.java index b18286ecf..4d884d6a6 100644 --- a/src/main/java/com/badbones69/crazycrates/api/objects/Crate.java +++ b/src/main/java/com/badbones69/crazycrates/api/objects/Crate.java @@ -530,13 +530,7 @@ public final CrateType getCrateType() { * @return the key as an item stack. */ public @NotNull final ItemStack getKey(Player player) { - final ItemStack itemStack = this.userManager.addPlaceholders(this.keyBuilder.setPlayer(player), this).getStack(); - - if (itemStack.hasItemMeta()) { - itemStack.editMeta(itemMeta -> itemMeta.setMaxStackSize(64)); - } - - return itemStack; + return this.userManager.addPlaceholders(this.keyBuilder.setPlayer(player), this).getStack(); } /** @@ -544,14 +538,7 @@ public final CrateType getCrateType() { * @return the key as an item stack. */ public @NotNull final ItemStack getKey(int amount) { - final ItemStack itemStack = this.keyBuilder.getStack(); - itemStack.setAmount(amount); - - if (itemStack.hasItemMeta()) { - itemStack.editMeta(itemMeta -> itemMeta.setMaxStackSize(64)); - } - - return itemStack; + return this.keyBuilder.setAmount(amount).getStack(); } /** @@ -560,14 +547,7 @@ public final CrateType getCrateType() { * @return the key as an item stack. */ public @NotNull final ItemStack getKey(int amount, Player player) { - final ItemStack itemStack = this.userManager.addPlaceholders(this.keyBuilder.setPlayer(player), this).getStack(); - itemStack.setAmount(amount); - - if (itemStack.hasItemMeta()) { - itemStack.editMeta(itemMeta -> itemMeta.setMaxStackSize(64)); - } - - return itemStack; + return this.userManager.addPlaceholders(this.keyBuilder.setPlayer(player), this).setAmount(amount).getStack(); } /** @@ -831,13 +811,7 @@ public final int getAbsolutePreviewItemPosition(final int baseSlot) { ArrayList items = new ArrayList<>(); for (final Prize prize : getPrizes()) { - ItemStack stack = prize.getDisplayItem(); - - if (stack.hasItemMeta()) { - stack.editMeta(itemMeta -> itemMeta.setMaxStackSize(64)); - } - - items.add(stack); + items.add(prize.getDisplayItem()); } return items; @@ -852,13 +826,7 @@ public final int getAbsolutePreviewItemPosition(final int baseSlot) { List items = new ArrayList<>(); for (final Prize prize : getPrizes()) { - ItemStack stack = prize.getDisplayItem(player); - - if (stack.hasItemMeta()) { - stack.editMeta(itemMeta -> itemMeta.setMaxStackSize(64)); - } - - items.add(stack); + items.add(prize.getDisplayItem(player)); } return items; @@ -875,13 +843,7 @@ public final int getAbsolutePreviewItemPosition(final int baseSlot) { for (final Prize prize : getPrizes()) { if (prize.getTiers().contains(tier)) { - ItemStack stack = prize.getDisplayItem(player); - - if (stack.hasItemMeta()) { - stack.editMeta(itemMeta -> itemMeta.setMaxStackSize(64)); - } - - prizes.add(stack); + prizes.add(prize.getDisplayItem(player)); } }