Catches a potential error when starting a new session
This commit is contained in:
parent
f5bfbfd4f8
commit
90d3c49c12
@ -94,7 +94,12 @@ public class BlacksmithTrait extends CustomTrait<BlacksmithSetting> {
|
|||||||
|
|
||||||
//Start a new reforge session for the player
|
//Start a new reforge session for the player
|
||||||
currentSessionStartTime = System.currentTimeMillis();
|
currentSessionStartTime = System.currentTimeMillis();
|
||||||
|
try {
|
||||||
session = new ReforgeSession(this, player, npc, config);
|
session = new ReforgeSession(this, player, npc, config);
|
||||||
|
} catch (IllegalArgumentException exception) {
|
||||||
|
BlacksmithPlugin.error(exception.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Tell the player the cost of repairing the item
|
//Tell the player the cost of repairing the item
|
||||||
String cost = EconomyManager.formatBlacksmithCost(player);
|
String cost = EconomyManager.formatBlacksmithCost(player);
|
||||||
|
@ -109,8 +109,13 @@ public class ScrapperTrait extends CustomTrait<ScrapperSetting> {
|
|||||||
|
|
||||||
//Start a new scrapper session for the player
|
//Start a new scrapper session for the player
|
||||||
currentSessionStartTime = System.currentTimeMillis();
|
currentSessionStartTime = System.currentTimeMillis();
|
||||||
|
try {
|
||||||
session = new SalvageSession(this, player, npc, getSettings(), result.salvage(),
|
session = new SalvageSession(this, player, npc, getSettings(), result.salvage(),
|
||||||
result.salvageMethod(), result.requiredAmount());
|
result.salvageMethod(), result.requiredAmount());
|
||||||
|
} catch (IllegalArgumentException exception) {
|
||||||
|
BlacksmithPlugin.error(exception.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Print the cost to the player
|
// Print the cost to the player
|
||||||
printCostMessage(player, itemInHand, EconomyManager.formatSalvageCost(result.salvageMethod()),
|
printCostMessage(player, itemInHand, EconomyManager.formatSalvageCost(result.salvageMethod()),
|
||||||
result.salvageMethod());
|
result.salvageMethod());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user