From 1cb084869049276c6eebded20a91f8762f5107bb Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 7 Mar 2024 21:23:46 -0600 Subject: [PATCH] 30 minute mine windows --- src/engine/objects/Mine.java | 12 ++++++++++-- src/engine/workthreads/HourlyJobThread.java | 8 ++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index dbd29bc4..6ac9259e 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -316,8 +316,16 @@ public class Mine extends AbstractGameObject { mineOpenTime = mineOpenTime.plusDays(1); mineCloseTime = mineCloseTime.plusDays(1); } - writer.putLocalDateTime(mineOpenTime); - writer.putLocalDateTime(mineCloseTime); + String aMpMOPEN = "AM"; + String aMpMCLOSE = "AM"; + if(mineOpenTime.isAfter(LocalDateTime.now().withHour(11).withMinute(59))){ + aMpMOPEN = "PM"; + } + if(mineCloseTime.isAfter(LocalDateTime.now().withHour(11).withMinute(59))){ + aMpMCLOSE = "PM"; + } + writer.putString(mineOpenTime.getHour() + ":" + mineOpenTime.getMinute() + " " + aMpMOPEN); + writer.putString(mineCloseTime.getHour() + ":" + mineCloseTime.getMinute() + " " + aMpMCLOSE); writer.put(mine.isActive ? (byte) 0x01 : (byte) 0x00); Building mineTower = BuildingManager.getBuilding(mine.buildingID); diff --git a/src/engine/workthreads/HourlyJobThread.java b/src/engine/workthreads/HourlyJobThread.java index 5f725842..bc512c0e 100644 --- a/src/engine/workthreads/HourlyJobThread.java +++ b/src/engine/workthreads/HourlyJobThread.java @@ -96,11 +96,15 @@ public class HourlyJobThread implements Runnable { if (mine.liveTime == LocalDateTime.now().getHour() && mine.wasClaimed == false) { if(mine.firstThirty == true && LocalDateTime.now().isAfter(LocalDateTime.now().withHour(mine.liveTime).withMinute(0).withSecond(0)) && LocalDateTime.now().isBefore(LocalDateTime.now().withHour(mine.liveTime).withMinute(30).withSecond(0))){ - mineWindowOpen(mine); + if(mine.isActive == false) { + mineWindowOpen(mine); + } continue; } if(mine.firstThirty == false && LocalDateTime.now().isAfter(LocalDateTime.now().withHour(mine.liveTime).withMinute(30).withSecond(0)) && LocalDateTime.now().isBefore(LocalDateTime.now().withHour(mine.liveTime).withMinute(0).withSecond(0).plusHours(1))){ - mineWindowOpen(mine); + if(mine.isActive == false) { + mineWindowOpen(mine); + } continue; }