Makes sure forced refunds always refund the full amount

This commit is contained in:
Kristian Knarvik 2022-11-13 22:39:11 +00:00
parent e7c40fb4b0
commit dd47ce06eb

View File

@ -153,7 +153,13 @@ public final class TrackedSignManager {
return; return;
} }
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(trackedSign.playerId()); OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(trackedSign.playerId());
double refundSum = trackedSign.cost() / 100 * PaidSigns.getInstance().getRefundPercentage(); double refundSum;
if (forceRefund) {
//In the case where a refund is forced, the normal refund rate should not apply
refundSum = trackedSign.cost();
} else {
refundSum = trackedSign.cost() / 100 * PaidSigns.getInstance().getRefundPercentage();
}
EconomyManager.deposit(offlinePlayer, refundSum); EconomyManager.deposit(offlinePlayer, refundSum);
if (offlinePlayer instanceof Player player) { if (offlinePlayer instanceof Player player) {
PaidSigns.getStringFormatter().displaySuccessMessage(player, String.format( PaidSigns.getStringFormatter().displaySuccessMessage(player, String.format(