From 0979af326da66d2e1e9bfd12d1562420328eabee Mon Sep 17 00:00:00 2001 From: Thiago Gebrim Date: Sun, 14 Apr 2024 11:41:50 -0300 Subject: [PATCH] changes the dev asked for --- .../nossr50/skills/herbalism/HerbalismManager.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index 5e98b9648..0a0353bec 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -798,8 +798,7 @@ public class HerbalismManager extends SkillManager { return false; } - // Check for seeds in both the main hand and off-hand - if (!(playerInventory.containsAtLeast(seedStack, 1) || playerInventory.getItemInOffHand().getType() == seed)) { + if (!playerInventory.contains(seedStack)) { NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Skills.NeedMore", StringUtils.getPrettyItemString(seed)); return false; } @@ -808,20 +807,13 @@ public class HerbalismManager extends SkillManager { return false; } - // Check the SubSkillEvent before removing items if (EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, blockState.getBlock()).isCancelled()) { return false; } else { - // Remove seed from the appropriate inventory slot (main hand or off-hand) - if (playerInventory.getItemInMainHand().getType() == seed) { - playerInventory.removeItem(new ItemStack(seed, 1)); - } else if (playerInventory.getItemInOffHand().getType() == seed) { - playerInventory.getItemInOffHand().setAmount(playerInventory.getItemInOffHand().getAmount() - 1); - } + playerInventory.removeItem(new ItemStack(seed, 1)); - player.updateInventory(); // Needed until replacement available + player.updateInventory(); - // Play sound SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_CONSUMED); return true; }