1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-07 00:38:42 +01:00

PaymentLimit should ignore timer when checking if user is under limit

This commit is contained in:
Zrips 2020-10-30 15:45:22 +02:00
parent 3d48656311
commit f58abe3827

View File

@ -82,16 +82,12 @@ public class PaymentData {
} }
public long getLeftTime(CurrencyType type) { public long getLeftTime(CurrencyType type) {
long left = 0; long left = getTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000);
if (getTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) > System.currentTimeMillis()) return left > System.currentTimeMillis() ? left - System.currentTimeMillis() : 0L;
left = (getTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) - System.currentTimeMillis());
return left;
} }
public boolean isOverLimit(CurrencyType type, int limit) { public boolean isOverLimit(CurrencyType type, int limit) {
if (payments.get(type).getAmount() < limit) return payments.get(type).getAmount() >= limit;
return false;
return true;
} }
public double percentOverLimit(CurrencyType type, int limit) { public double percentOverLimit(CurrencyType type, int limit) {
@ -99,8 +95,9 @@ public class PaymentData {
} }
public boolean isOverTimeLimit(CurrencyType type) { public boolean isOverTimeLimit(CurrencyType type) {
if (getTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) > System.currentTimeMillis()) if (getTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) > System.currentTimeMillis()) {
return false; return false;
}
if (informed) if (informed)
informed = false; informed = false;
resetLimits(); resetLimits();
@ -120,7 +117,8 @@ public class PaymentData {
} }
public boolean isReachedLimit(CurrencyType type, int money) { public boolean isReachedLimit(CurrencyType type, int money) {
return isOverTimeLimit(type) || isOverLimit(type, money); isOverTimeLimit(type);
return isOverLimit(type, money);
} }
public boolean isInformed() { public boolean isInformed() {