Browse Source

mine window processing

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

7
src/engine/workthreads/MineThread.java

@ -25,7 +25,7 @@ public class MineThread implements Runnable { @@ -25,7 +25,7 @@ public class MineThread implements Runnable {
nextPulse = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0);
while (true) {
if(LocalDateTime.now().isAfter(nextPulse)) {
processMineWindows();
processMineWindows(nextPulse);
}
}
}
@ -104,16 +104,13 @@ public class MineThread implements Runnable { @@ -104,16 +104,13 @@ public class MineThread implements Runnable {
return true;
}
public static void processMineWindows(){
public static void processMineWindows(LocalDateTime currentTime){
for (Mine mine : Mine.getMines()) {
Building tower = BuildingManager.getBuildingFromCache(mine.getBuildingID());
//if the tower comes back null, skip this mine
if(tower == null)
continue;
//log the current time right now
LocalDateTime currentTime = LocalDateTime.now().plusMinutes(1);
//check if this mine needs to open
LocalDateTime openTime = LocalDateTime.now().withHour(mine.liveHour).withMinute(mine.liveMinute).withSecond(0).withNano(0);
if(currentTime.isAfter(openTime) && currentTime.isBefore(openTime.plusMinutes(30)) && !mine.wasOpened){

Loading…
Cancel
Save