Change updater from 30 seconds to 30 minutes

This commit is contained in:
libraryaddict 2020-11-12 11:04:52 +13:00
parent f84ced34f6
commit ca17028aef

View File

@ -314,8 +314,6 @@ public class DisguiseConfig {
return; return;
} }
int timer = (int) (TimeUnit.HOURS.toSeconds(isHittingRateLimit() ? 36 : 6) * 20);
if (!LibsDisguises.getInstance().getConfig().getDefaults().getBoolean("AutoUpdate")) { if (!LibsDisguises.getInstance().getConfig().getDefaults().getBoolean("AutoUpdate")) {
updaterTask = Bukkit.getScheduler().runTaskTimer(LibsDisguises.getInstance(), new Runnable() { updaterTask = Bukkit.getScheduler().runTaskTimer(LibsDisguises.getInstance(), new Runnable() {
@Override @Override
@ -342,11 +340,13 @@ public class DisguiseConfig {
return; return;
} }
int timer = (int) (TimeUnit.HOURS.toSeconds(isHittingRateLimit() ? 36 : 6) * 20);
// Get the ticks since last update // Get the ticks since last update
long timeSinceLast = (System.currentTimeMillis() - getLastUpdateRequest()) / 50; long timeSinceLast = (System.currentTimeMillis() - getLastUpdateRequest()) / 50;
// Next update check will be in 30 seconds, or the timer - elapsed time. Whatever is greater // Next update check will be in 30 minutes, or the timer - elapsed time. Whatever is greater
timeSinceLast = Math.max(30 * 20, timer - timeSinceLast); timeSinceLast = Math.max(30 * 60 * 20, timer - timeSinceLast);
updaterTask = Bukkit.getScheduler().runTaskTimerAsynchronously(LibsDisguises.getInstance(), new Runnable() { updaterTask = Bukkit.getScheduler().runTaskTimerAsynchronously(LibsDisguises.getInstance(), new Runnable() {
@Override @Override