From ef62c2bb39735e256dda43114b450ef6a3ab5a3f Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 11 Jun 2024 20:53:33 -0500 Subject: [PATCH] mines open and close --- src/engine/objects/Mine.java | 2 +- .../workthreads/HalfHourlyJobThread.java | 25 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index 15371ce6..309aea48 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -189,7 +189,7 @@ public class Mine extends AbstractGameObject { Guild mineNatonGuild = mine.getOwningGuild().getNation(); writer.putLocalDateTime(mineOpenTime); - writer.putLocalDateTime(mineOpenTime.plusHours(1)); + writer.putLocalDateTime(mineOpenTime.plusMinutes(30)); writer.put(mine.isActive ? (byte) 0x01 : (byte) 0x00); Building mineTower = BuildingManager.getBuilding(mine.buildingID); diff --git a/src/engine/workthreads/HalfHourlyJobThread.java b/src/engine/workthreads/HalfHourlyJobThread.java index 6419f495..b26d3690 100644 --- a/src/engine/workthreads/HalfHourlyJobThread.java +++ b/src/engine/workthreads/HalfHourlyJobThread.java @@ -41,18 +41,8 @@ public class HalfHourlyJobThread implements Runnable { ArrayList mines = Mine.getMines(); for (Mine mine : mines) { - if (LocalDateTime.now().getHour() == 1400) { - mine.wasClaimed = false; - } try { - // Open Errant Mines - - if (mine.getOwningGuild().isEmptyGuild()) { - HalfHourlyJobThread.mineWindowOpen(mine); - continue; - } - // Open Mines owned by nations having their WOO // set to the current mine window. @@ -62,8 +52,9 @@ public class HalfHourlyJobThread implements Runnable { } // Close the mine if it reaches this far - - mineWindowClose(mine); + LocalDateTime openTime = LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute); + if(LocalDateTime.now().plusMinutes(1).isAfter(openTime.plusMinutes(30))) + mineWindowClose(mine); } catch (Exception e) { Logger.error("mineID: " + mine.getObjectUUID(), e.toString()); @@ -101,6 +92,10 @@ public class HalfHourlyJobThread implements Runnable { if (mineBuilding.getRank() > 0) { mine.setActive(false); mine.lastClaimer = null; + ChatSystemMsg chatMsg = new ChatSystemMsg(null, mine.guildName + " has defended the mine in " + mine.getParentZone().getParent().getName() + ". The mine is no longer active."); + chatMsg.setMessageType(10); + chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID()); + DispatchMessage.dispatchMsgToAll(chatMsg); return true; } @@ -112,6 +107,10 @@ public class HalfHourlyJobThread implements Runnable { mine.lastClaimer = null; mine.updateGuildOwner(null); mine.setActive(true); + ChatSystemMsg chatMsg = new ChatSystemMsg(null, mine.getParentZone().getParent().getName() + " Was not claimed, the battle rages on!"); + chatMsg.setMessageType(10); + chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID()); + DispatchMessage.dispatchMsgToAll(chatMsg); return false; } @@ -163,7 +162,7 @@ public class HalfHourlyJobThread implements Runnable { } catch (Exception e) { Logger.info(e.getMessage() + " for Mine " + mine.getObjectUUID()); } - if (mine.wasClaimed == true) + if (mine.wasClaimed == false) mine.wasClaimed = false; } }