|
|
|
@ -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){ |
|
|
|
|