From 24bc0097be35ce8d8b5a3a609e911fb6bd192aff Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 7 Mar 2024 19:45:12 -0600 Subject: [PATCH] 30 minute mine windows --- src/engine/objects/Mine.java | 9 ++++ src/engine/server/world/WorldServer.java | 6 ++- src/engine/workthreads/HourlyJobThread.java | 55 ++++----------------- 3 files changed, 24 insertions(+), 46 deletions(-) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index a2ea484e..1a93fa2a 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -60,6 +60,7 @@ public class Mine extends AbstractGameObject { public boolean hasProduced = false; public int liveTime; + public Boolean fullHour = true; public static ArrayList ChinaMines = new ArrayList<>(); public static ArrayList 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; diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 86b23490..8e07c464 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -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)) { diff --git a/src/engine/workthreads/HourlyJobThread.java b/src/engine/workthreads/HourlyJobThread.java index 0fdb38f6..50f14331 100644 --- a/src/engine/workthreads/HourlyJobThread.java +++ b/src/engine/workthreads/HourlyJobThread.java @@ -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!