From 11827d1e834b8cdea7290b4a8bd387d2a83bba62 Mon Sep 17 00:00:00 2001 From: Brianna Date: Tue, 24 Sep 2019 11:31:11 -0400 Subject: [PATCH] Fixed issue where the economy cost was displaying as xp cost. --- src/main/java/com/songoda/epicfurnaces/furnace/Furnace.java | 3 ++- src/main/java/com/songoda/epicfurnaces/gui/GUIOverview.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/songoda/epicfurnaces/furnace/Furnace.java b/src/main/java/com/songoda/epicfurnaces/furnace/Furnace.java index 32a7c23..3ea303d 100644 --- a/src/main/java/com/songoda/epicfurnaces/furnace/Furnace.java +++ b/src/main/java/com/songoda/epicfurnaces/furnace/Furnace.java @@ -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); diff --git a/src/main/java/com/songoda/epicfurnaces/gui/GUIOverview.java b/src/main/java/com/songoda/epicfurnaces/gui/GUIOverview.java index 1f01e0e..bfc6d4d 100644 --- a/src/main/java/com/songoda/epicfurnaces/gui/GUIOverview.java +++ b/src/main/java/com/songoda/epicfurnaces/gui/GUIOverview.java @@ -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);