diff --git a/src/main/java/net/knarcraft/blacksmith/trait/BlacksmithTrait.java b/src/main/java/net/knarcraft/blacksmith/trait/BlacksmithTrait.java index 80bc932..f3980e8 100644 --- a/src/main/java/net/knarcraft/blacksmith/trait/BlacksmithTrait.java +++ b/src/main/java/net/knarcraft/blacksmith/trait/BlacksmithTrait.java @@ -94,7 +94,12 @@ public class BlacksmithTrait extends CustomTrait { //Start a new reforge session for the player currentSessionStartTime = System.currentTimeMillis(); - session = new ReforgeSession(this, player, npc, config); + try { + session = new ReforgeSession(this, player, npc, config); + } catch (IllegalArgumentException exception) { + BlacksmithPlugin.error(exception.getMessage()); + return; + } //Tell the player the cost of repairing the item String cost = EconomyManager.formatBlacksmithCost(player); diff --git a/src/main/java/net/knarcraft/blacksmith/trait/ScrapperTrait.java b/src/main/java/net/knarcraft/blacksmith/trait/ScrapperTrait.java index 8fef8f3..e8138d9 100644 --- a/src/main/java/net/knarcraft/blacksmith/trait/ScrapperTrait.java +++ b/src/main/java/net/knarcraft/blacksmith/trait/ScrapperTrait.java @@ -109,8 +109,13 @@ public class ScrapperTrait extends CustomTrait { //Start a new scrapper session for the player currentSessionStartTime = System.currentTimeMillis(); - session = new SalvageSession(this, player, npc, getSettings(), result.salvage(), - result.salvageMethod(), result.requiredAmount()); + try { + session = new SalvageSession(this, player, npc, getSettings(), result.salvage(), + result.salvageMethod(), result.requiredAmount()); + } catch (IllegalArgumentException exception) { + BlacksmithPlugin.error(exception.getMessage()); + return; + } // Print the cost to the player printCostMessage(player, itemInHand, EconomyManager.formatSalvageCost(result.salvageMethod()), result.salvageMethod());