Complete JodaTime -> java.time migration (remaining objects, db handlers, net msg, jobs) + QC pass; untrack working reference files

This commit is contained in:
SlaveOfMagicbot committed 2026-10-05 23:01:19 -05:00
1 parent efd35e89f1
commit 93eb77fcc8
26 files changed
+160 -426

No files matched your search

+23 -23
View File
@@ -30,7 +30,8 @@ import engine.net.client.ClientConnection;
import engine.net.client.msg.PlaceAssetMsg;
import engine.net.client.msg.chat.ChatSystemMsg;
import engine.server.MBServerStatics;
import org.joda.time.DateTime;
import java.time.LocalDateTime;
import java.time.ZoneId;
import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
@@ -45,8 +46,8 @@ public final class Bane {
private final int cityUUID;
private final int stoneUUID;
private int ownerUUID;
private DateTime placementDate = null;
private DateTime liveDate = null;
private LocalDateTime placementDate = null;
private LocalDateTime liveDate = null;
private BaneDefaultTimeJob defaultTimeJob;
// Internal cache for banes
@@ -67,12 +68,12 @@ public final class Bane {
sqlDateTime = rs.getTimestamp("placementDate");
if (sqlDateTime != null)
this.placementDate = new DateTime(sqlDateTime);
this.placementDate = sqlDateTime.toLocalDateTime();
sqlDateTime = rs.getTimestamp("liveDate");
if (sqlDateTime != null)
this.liveDate = new DateTime(sqlDateTime);
this.liveDate = sqlDateTime.toLocalDateTime();
switch (this.getSiegePhase()) {
@@ -86,7 +87,7 @@ public final class Bane {
this.activateBaneJob.cancelJob();
abtj = new ActivateBaneJob(cityUUID);
JobScheduler.getInstance().scheduleJob(abtj, this.liveDate.getMillis());
JobScheduler.getInstance().scheduleJob(abtj, toEpochMillis(this.liveDate));
this.activateBaneJob = abtj;
break;
@@ -98,7 +99,7 @@ public final class Bane {
this.activateBaneJob.cancelJob();
abtj = new ActivateBaneJob(cityUUID);
JobScheduler.getInstance().scheduleJob(abtj, this.liveDate.getMillis());
JobScheduler.getInstance().scheduleJob(abtj, toEpochMillis(this.liveDate));
this.activateBaneJob = abtj;
break;
@@ -356,7 +357,7 @@ public final class Bane {
return phase;
}
if (DateTime.now().isAfter(this.liveDate)) {
if (LocalDateTime.now().isAfter(this.liveDate)) {
phase = SiegePhase.WAR; //war
return phase;
}
@@ -371,15 +372,10 @@ public final class Bane {
private 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);
LocalDateTime timeToSetDefault = this.placementDate.plusDays(1);
LocalDateTime currentTime = LocalDateTime.now();
LocalDateTime defaultTime = this.placementDate.plusDays(2)
.withHour(22).withMinute(0).withSecond(0).withNano(0);
if (currentTime.isAfter(timeToSetDefault))
this.setLiveDate(defaultTime);
@@ -389,7 +385,7 @@ public final class Bane {
this.defaultTimeJob.cancelJob();
BaneDefaultTimeJob bdtj = new BaneDefaultTimeJob(this);
JobScheduler.getInstance().scheduleJob(bdtj, timeToSetDefault.getMillis());
JobScheduler.getInstance().scheduleJob(bdtj, toEpochMillis(timeToSetDefault));
this.defaultTimeJob = bdtj;
}
}
@@ -456,7 +452,7 @@ public final class Bane {
return true;
}
public final DateTime getPlacementDate() {
public final LocalDateTime getPlacementDate() {
return placementDate;
}
@@ -465,14 +461,14 @@ public final class Bane {
return (this.getSiegePhase() != SiegePhase.CHALLENGE);
}
public final DateTime getLiveDate() {
public final LocalDateTime getLiveDate() {
return liveDate;
}
public void setLiveDate(DateTime baneTime) {
public void setLiveDate(LocalDateTime baneTime) {
if (DbManager.BaneQueries.SET_BANE_TIME(baneTime, this.getCity().getObjectUUID())) {
this.liveDate = new DateTime(baneTime);
this.liveDate = baneTime;
// Push event to warehouse
@@ -514,7 +510,7 @@ public final class Bane {
ActivateBaneJob abtj = new ActivateBaneJob(cityUUID);
JobScheduler.getInstance().scheduleJob(abtj, this.liveDate.getMillis());
JobScheduler.getInstance().scheduleJob(abtj, toEpochMillis(this.liveDate));
this.activateBaneJob = abtj;
} else {
Logger.debug("error with city " + this.getCity().getName());
@@ -644,4 +640,8 @@ public final class Bane {
return cityUUID;
}
private static long toEpochMillis(LocalDateTime ldt) {
return ldt.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
}
}