mirror of
https://github.com/Auxilor/Reforges.git
synced 2025-12-27 19:09:15 +00:00
Fixed insufficient exp withdrawing money while failing
This commit is contained in:
@@ -56,14 +56,15 @@ public class ReforgeHandler extends PluginDependent<EcoPlugin> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
double cost = 0;
|
||||
if (EconomyHandler.isEnabled()) {
|
||||
double cost = this.getPlugin().getConfigYml().getDouble("reforge.cost");
|
||||
cost = this.getPlugin().getConfigYml().getDouble("reforge.cost");
|
||||
int reforges = ReforgeUtils.getReforges(toReforge);
|
||||
cost *= Math.pow(this.getPlugin().getConfigYml().getDouble("reforge.cost-exponent"), reforges);
|
||||
if (reforge.getRequiresStone() && reforge.getStonePrice() != -1) {
|
||||
cost = reforge.getStonePrice();
|
||||
}
|
||||
|
||||
if (!EconomyHandler.getInstance().has(player, cost)) {
|
||||
player.sendMessage(this.getPlugin().getLangYml().getMessage("insufficient-money"));
|
||||
|
||||
@@ -76,9 +77,6 @@ public class ReforgeHandler extends PluginDependent<EcoPlugin> {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
EconomyHandler.getInstance().withdrawPlayer(player, cost);
|
||||
}
|
||||
|
||||
int xpCost = this.getPlugin().getConfigYml().getInt("reforge.xp-cost");
|
||||
@@ -97,6 +95,10 @@ public class ReforgeHandler extends PluginDependent<EcoPlugin> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (EconomyHandler.isEnabled()) {
|
||||
EconomyHandler.getInstance().withdrawPlayer(player, cost);
|
||||
}
|
||||
|
||||
player.setLevel(player.getLevel() - xpCost);
|
||||
|
||||
player.sendMessage(this.getPlugin().getLangYml().getMessage("applied-reforge").replace("%reforge%", reforge.getName()));
|
||||
|
||||
Reference in New Issue
Block a user