Fixes a bug in refunding

This commit is contained in:
Kristian Knarvik 2022-03-03 11:33:50 +01:00
parent c2ffe5e903
commit a7d1da7f8a
2 changed files with 11 additions and 1 deletions

View File

@ -58,4 +58,14 @@ public final class EconomyManager {
economy.withdrawPlayer(player, cost);
}
/**
* Deposits a given sum into the given player's account
*
* @param player <p>The player to deposit money to</p>
* @param sum <p>The amount of money to deposit</p>
*/
public static void deposit(OfflinePlayer player, double sum) {
economy.depositPlayer(player, sum);
}
}

View File

@ -64,7 +64,7 @@ public final class TrackedSignManager {
}
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(trackedSign.getPlayerId());
double refundSum = trackedSign.getCost() / 100 * PaidSigns.getInstance().getRefundPercentage();
EconomyManager.withdraw(offlinePlayer, -refundSum);
EconomyManager.deposit(offlinePlayer, refundSum);
if (offlinePlayer instanceof Player player) {
player.sendMessage(String.format(StringFormatter.replacePlaceholders(
StringFormatter.getTranslatedInfoMessage(TranslatableMessage.SUCCESS_REFUNDED),