From 29d65dc3c4f35ebc3eefb277604a433ad9d15417 Mon Sep 17 00:00:00 2001 From: Zrips Date: Fri, 17 Nov 2023 16:05:11 +0200 Subject: [PATCH] Potion and arrow recognition when crafting fix --- .../jobs/listeners/JobsPaymentListener.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 6d4c0baa..8f5efa12 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -789,10 +789,20 @@ public final class JobsPaymentListener implements Listener { } } + if (resultStack == null) + return; + while (newItemsCount > 0) { newItemsCount--; - Jobs.action(jPlayer, new ItemActionInfo(resultStack, type)); + if (resultStack.getItemMeta() instanceof PotionMeta) { + PotionMeta potion = (PotionMeta) resultStack.getItemMeta(); + Jobs.action(jPlayer, new PotionItemActionInfo(resultStack, type, potion.getBasePotionData().getType())); + } else if (resultStack.hasItemMeta() && resultStack.getItemMeta().hasDisplayName()) { + Jobs.action(jPlayer, new ItemNameActionInfo(CMIChatColor.stripColor(resultStack.getItemMeta().getDisplayName()), type)); + } else { + Jobs.action(jPlayer, new ItemActionInfo(resultStack, type)); + } } } }, 1);