30 minute mine windows

This commit is contained in:
2024-03-07 19:45:12 -06:00
parent 7175f79bfe
commit 24bc0097be
3 changed files with 24 additions and 46 deletions
+9
View File
@@ -60,6 +60,7 @@ public class Mine extends AbstractGameObject {
public boolean hasProduced = false;
public int liveTime;
public Boolean fullHour = true;
public static ArrayList<Mine> ChinaMines = new ArrayList<>();
public static ArrayList<Mine> EuroMines = new ArrayList<>();
@@ -122,9 +123,17 @@ public class Mine extends AbstractGameObject {
public static void SetTimes(){
EuroMines.get(0).liveTime = 12;
EuroMines.get(0).fullHour = true;
EuroMines.get(1).liveTime = 12;
EuroMines.get(1).fullHour = false;
EuroMines.get(2).liveTime = 12;
EuroMines.get(2).fullHour = false;
EuroMines.get(3).liveTime = 12;
EuroMines.get(3).fullHour = true;
EuroMines.get(4).liveTime = 13;
EuroMines.get(5).liveTime = 13;
EuroMines.get(6).liveTime = 13;
+5 -1
View File
@@ -230,7 +230,11 @@ public class WorldServer {
Thread hourlyJobThread = new Thread(new HourlyJobThread());
hourlyJobThread.setName("hourlyJob");
hourlyJobThread.start();
nextHourlyJobTime = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(1);
if(LocalDateTime.now().isAfter(LocalDateTime.now().withMinute(30).withSecond(0))) {
nextHourlyJobTime = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(1);
}else{
nextHourlyJobTime = LocalDateTime.now().withMinute(30).withSecond(0);
}
}
if (LocalDateTime.now().isAfter(nextWareHousePushTime)) {
+10 -45
View File
@@ -95,13 +95,16 @@ public class HourlyJobThread implements Runnable {
// Open Mines owned by nations having their WOO
// set to the current mine window.
if (mine.liveTime ==
LocalDateTime.now().getHour() && mine.wasClaimed == false) {
HourlyJobThread.mineWindowOpen(mine);
continue;
}
if (mine.liveTime == LocalDateTime.now().getHour() && mine.wasClaimed == false) {
if (mine.fullHour == true) {
HourlyJobThread.mineWindowOpen(mine);
continue;
}
else if(LocalDateTime.now().isBefore(LocalDateTime.now().withMinute(29).withSecond(59))) {
mineWindowOpen(mine);
continue;
}
}
// Close the mine if it reaches this far
mineWindowClose(mine);
@@ -190,46 +193,8 @@ public class HourlyJobThread implements Runnable {
Logger.info("Hourly job is now running.");
//try {
// Use the same hotZone this hour up and until
// the HotZone_Duration from the ConfigManager
//if (ZoneManager.hotZone == null)
// ZoneManager.generateAndSetRandomHotzone();
//else
// ZoneManager.hotZoneCycle = ZoneManager.hotZoneCycle + 1;
//if (ZoneManager.hotZoneCycle > Integer.parseInt(ConfigManager.MB_HOTZONE_DURATION.getValue()))
// ZoneManager.generateAndSetRandomHotzone();
//if (ZoneManager.hotZone == null) {
// Logger.error("Null HotZone returned from ZoneManager");
//} else {
// Logger.info("HotZone switched to: " + ZoneManager.hotZone.getName());
//}
//} catch (Exception e) {
// Logger.error(e.toString());
//}
// Open or Close mines for the current mine window.
processMineWindow();
// Deposit mine resources to Guilds
//for (Mine mine : Mine.getMines()) {
// try {
// if (mine.hasProduced == false) {
/// mine.depositMineResources();
// }
// } catch (Exception e) {
// Logger.info(e.getMessage() + " for Mine " + mine.getObjectUUID());
// }
//}
// Reset time-gated access to WOO slider.
// *** Do this after the mines open/close!