From c90378e3f0103885d2186ed25640600170519918 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 22 May 2024 20:33:03 -0500 Subject: [PATCH] delay mine checks to 1 minute intervals --- src/engine/workthreads/MineThread.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/engine/workthreads/MineThread.java b/src/engine/workthreads/MineThread.java index f0e1f424..48c8756b 100644 --- a/src/engine/workthreads/MineThread.java +++ b/src/engine/workthreads/MineThread.java @@ -22,18 +22,23 @@ public class MineThread implements Runnable { } @Override public void run() { - //LocalDateTime nextPulse = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0); + LocalDateTime nextPulse = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0); while (true) { + + LocalDateTime now = LocalDateTime.now(); + if(now.isBefore(nextPulse)) + break; + nextPulse = nextPulse.plusMinutes(1); for (Mine mine : Mine.getMines()) { if(mine.wasClaimed) continue; - LocalDateTime now = LocalDateTime.now(); + int minute = 0; if (!mine.firstThirty) minute = 30; - LocalDateTime openTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(minute).withSecond(0); + LocalDateTime openTime = now.withHour(mine.liveTime).withMinute(minute).withSecond(0); LocalDateTime closeTime = openTime.plusMinutes(30); if (now.isAfter(openTime) && !mine.isActive) {