Browse Source

delay mine checks to 1 minute intervals

lakebane-master
FatBoy-DOTC 6 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 {
} }
@Override @Override
public void run() { 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) { while (true) {
LocalDateTime now = LocalDateTime.now();
if(now.isBefore(nextPulse))
break;
nextPulse = nextPulse.plusMinutes(1);
for (Mine mine : Mine.getMines()) { for (Mine mine : Mine.getMines()) {
if(mine.wasClaimed) if(mine.wasClaimed)
continue; continue;
LocalDateTime now = LocalDateTime.now();
int minute = 0; int minute = 0;
if (!mine.firstThirty) if (!mine.firstThirty)
minute = 30; 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); LocalDateTime closeTime = openTime.plusMinutes(30);
if (now.isAfter(openTime) && !mine.isActive) { if (now.isAfter(openTime) && !mine.isActive) {

Loading…
Cancel
Save