From 72b2e54331b08d44fe8a76b416bdc68d9a7e5034 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 10 Jan 2025 21:06:29 -0600 Subject: [PATCH] banes to set default times --- src/engine/objects/Bane.java | 36 ++++++++------------- src/engine/workthreads/HourlyJobThread.java | 6 ++++ 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/engine/objects/Bane.java b/src/engine/objects/Bane.java index b59acff0..ca574eb6 100644 --- a/src/engine/objects/Bane.java +++ b/src/engine/objects/Bane.java @@ -428,32 +428,24 @@ public final class Bane { // Cache access - private void setDefaultTime() { + public void setDefaultTime() { DateTime timeToSetDefault = new DateTime(this.placementDate); timeToSetDefault = timeToSetDefault.plusDays(1); - DateTime currentTime = DateTime.now(); - DateTime defaultTime = new DateTime(this.placementDate); - defaultTime = defaultTime.plusDays(2); - defaultTime = defaultTime.hourOfDay().setCopy(22); - defaultTime = defaultTime.minuteOfHour().setCopy(0); - defaultTime = defaultTime.secondOfMinute().setCopy(0); - - if (currentTime.isAfter(timeToSetDefault)){ - DbManager.BaneQueries.SET_BANE_CAP_NEW(20,this.getCityUUID()); - DbManager.BaneQueries.SET_BANE_TIME_NEW(9,this.getCityUUID()); - DbManager.BaneQueries.SET_BANE_DAY_NEW(3,this.getCityUUID()); - } - //this.setLiveDate(defaultTime); - else { - - if (this.defaultTimeJob != null) - this.defaultTimeJob.cancelJob(); - - BaneDefaultTimeJob bdtj = new BaneDefaultTimeJob(this); - JobScheduler.getInstance().scheduleJob(bdtj, timeToSetDefault.getMillis()); - this.defaultTimeJob = bdtj; + if (DateTime.now().isAfter(timeToSetDefault)){ + if(!this.capSet){ + DbManager.BaneQueries.SET_BANE_CAP_NEW(20,this.getCityUUID()); + this.capSet = true; + } + if(!this.daySet){ + DbManager.BaneQueries.SET_BANE_DAY_NEW(3,this.getCityUUID()); + this.daySet = true; + } + if(!this.timeSet){ + DbManager.BaneQueries.SET_BANE_TIME_NEW(9,this.getCityUUID()); + this.timeSet = true; + } } } diff --git a/src/engine/workthreads/HourlyJobThread.java b/src/engine/workthreads/HourlyJobThread.java index 309bb721..118d385d 100644 --- a/src/engine/workthreads/HourlyJobThread.java +++ b/src/engine/workthreads/HourlyJobThread.java @@ -88,5 +88,11 @@ public class HourlyJobThread implements Runnable { Logger.info(SimulationManager.getPopulationString()); Logger.info(MessageDispatcher.getNetstatString()); Logger.info(PurgeOprhans.recordsDeleted.toString() + "orphaned items deleted"); + + for (Bane bane : Bane.banes.values()){ + if(bane.getSiegePhase().equals(Enum.SiegePhase.CHALLENGE)){ + bane.setDefaultTime(); + } + } } }