Fixed issue where the economy cost was displaying as xp cost.

This commit is contained in:
Brianna 2019-09-24 11:31:11 -04:00
parent aa920f0005
commit 11827d1e83
2 changed files with 3 additions and 2 deletions

View File

@ -114,9 +114,9 @@ public class Furnace {
if (plugin.getLevelManager().getLevels().containsKey(this.level.getLevel() + 1)) {
Level level = plugin.getLevelManager().getLevel(this.level.getLevel() + 1);
int cost = type == CostType.ECONOMY ? level.getCostEconomy() : level.getCostExperience();
if (type == CostType.ECONOMY) {
int cost = level.getCostEconomy();
if (!EconomyManager.isEnabled()) {
player.sendMessage("Economy not enabled.");
return;
@ -129,6 +129,7 @@ public class Furnace {
EconomyManager.withdrawBalance(player, cost);
upgradeFinal(level, player);
} else if (type == CostType.EXPERIENCE) {
int cost = level.getCostExperience();
if (player.getLevel() >= cost || player.getGameMode() == GameMode.CREATIVE) {
if (player.getGameMode() != GameMode.CREATIVE) {
player.setLevel(player.getLevel() - cost);

View File

@ -179,7 +179,7 @@ public class GUIOverview extends Gui {
plugin.getLocale().getMessage("interface.furnace.upgradewitheconomy").getMessage(),
nextLevel != null
? plugin.getLocale().getMessage("interface.furnace.upgradewitheconomylore")
.processPlaceholder("cost", nextLevel.getCostExperience()).getMessage()
.processPlaceholder("cost", Methods.formatEconomy(nextLevel.getCostEconomy())).getMessage()
: plugin.getLocale().getMessage("interface.furnace.alreadymaxed").getMessage()),
(event) -> {
furnace.upgrade(player, CostType.ECONOMY);