Browse Source

delay mine checks to 1 minute intervals

lakebane-master
FatBoy-DOTC 7 months ago
parent
commit
c90378e3f0
  1. 11
      src/engine/workthreads/MineThread.java

11
src/engine/workthreads/MineThread.java

@ -22,18 +22,23 @@ public class MineThread implements Runnable { @@ -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) {

Loading…
Cancel
Save