forked from MagicBane/Server
new mine handling system
This commit is contained in:
@@ -16,18 +16,12 @@ import org.pmw.tinylog.Logger;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class MineThread implements Runnable {
|
||||
public static LocalDateTime nextPulse;
|
||||
public MineThread(){
|
||||
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
nextPulse = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0);
|
||||
while (true) {
|
||||
if(LocalDateTime.now().isAfter(nextPulse)) {
|
||||
processMineWindows(nextPulse);
|
||||
}
|
||||
}
|
||||
processMineWindows();
|
||||
}
|
||||
|
||||
public static void mineWindowOpen(Mine mine) {
|
||||
@@ -104,7 +98,8 @@ public class MineThread implements Runnable {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void processMineWindows(LocalDateTime currentTime){
|
||||
public static void processMineWindows(){
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
for (Mine mine : Mine.getMines()) {
|
||||
Building tower = BuildingManager.getBuildingFromCache(mine.getBuildingID());
|
||||
//if the tower comes back null, skip this mine
|
||||
@@ -139,6 +134,5 @@ public class MineThread implements Runnable {
|
||||
|
||||
}
|
||||
}
|
||||
nextPulse = nextPulse.plusMinutes(30);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user