From f58abe38274bde99e17886ccf552313fd4de8434 Mon Sep 17 00:00:00 2001 From: Zrips Date: Fri, 30 Oct 2020 15:45:22 +0200 Subject: [PATCH] PaymentLimit should ignore timer when checking if user is under limit --- .../com/gamingmesh/jobs/economy/PaymentData.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/economy/PaymentData.java b/src/main/java/com/gamingmesh/jobs/economy/PaymentData.java index bfe93c1e..a06f8ff9 100644 --- a/src/main/java/com/gamingmesh/jobs/economy/PaymentData.java +++ b/src/main/java/com/gamingmesh/jobs/economy/PaymentData.java @@ -82,16 +82,12 @@ public class PaymentData { } public long getLeftTime(CurrencyType type) { - long left = 0; - if (getTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) > System.currentTimeMillis()) - left = (getTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) - System.currentTimeMillis()); - return left; + long left = getTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000); + return left > System.currentTimeMillis() ? left - System.currentTimeMillis() : 0L; } public boolean isOverLimit(CurrencyType type, int limit) { - if (payments.get(type).getAmount() < limit) - return false; - return true; + return payments.get(type).getAmount() >= limit; } public double percentOverLimit(CurrencyType type, int limit) { @@ -99,8 +95,9 @@ public class PaymentData { } 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; + } if (informed) informed = false; resetLimits(); @@ -120,7 +117,8 @@ public class PaymentData { } public boolean isReachedLimit(CurrencyType type, int money) { - return isOverTimeLimit(type) || isOverLimit(type, money); + isOverTimeLimit(type); + return isOverLimit(type, money); } public boolean isInformed() {