Migrate JodaTime to java.time.* in BaneRecord.java
This commit is contained in:
@@ -14,7 +14,7 @@ import engine.gameManager.DbManager;
|
||||
import engine.objects.Bane;
|
||||
import engine.objects.City;
|
||||
import engine.workthreads.WarehousePushThread;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.*;
|
||||
@@ -34,8 +34,8 @@ public class BaneRecord extends DataRecord {
|
||||
private String baneDropperHash;
|
||||
private String baneGuildHash;
|
||||
private String baneNationHash;
|
||||
private DateTime baneLiveTime;
|
||||
private DateTime baneDropTime;
|
||||
private Instant baneLiveTime;
|
||||
private Instant baneDropTime;
|
||||
|
||||
private BaneRecord(Bane bane) {
|
||||
this.recordType = Enum.DataRecordType.BANE;
|
||||
@@ -129,9 +129,9 @@ public class BaneRecord extends DataRecord {
|
||||
return outStatement;
|
||||
}
|
||||
|
||||
public static DateTime getLastBaneDateTime(City city) {
|
||||
public static Instant getLastBaneDateTime(City city) {
|
||||
|
||||
DateTime outDateTime = null;
|
||||
Instant outDateTime = null;
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement statement = buildDateTimeQueryStatement(connection, city);
|
||||
@@ -139,7 +139,7 @@ public class BaneRecord extends DataRecord {
|
||||
|
||||
while (rs.next()) {
|
||||
|
||||
outDateTime = new DateTime(rs.getTimestamp("endDatetime"));
|
||||
outDateTime = rs.getTimestamp("endDatetime").toInstant();
|
||||
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class BaneRecord extends DataRecord {
|
||||
|
||||
}
|
||||
|
||||
public static void updateLiveDate(Bane bane, DateTime dateTime) {
|
||||
public static void updateLiveDate(Bane bane, Instant dateTime) {
|
||||
|
||||
if (bane == null)
|
||||
return;
|
||||
@@ -175,13 +175,13 @@ public class BaneRecord extends DataRecord {
|
||||
}
|
||||
}
|
||||
|
||||
private static PreparedStatement buildUpdateLiveDateStatement(Connection connection, Bane bane, DateTime dateTime) throws SQLException {
|
||||
private static PreparedStatement buildUpdateLiveDateStatement(Connection connection, Bane bane, Instant dateTime) throws SQLException {
|
||||
|
||||
PreparedStatement outStatement = null;
|
||||
String queryString = "UPDATE `warehouse_banehistory` SET `liveDatetime` = ?, `dirty` = 1 WHERE `city_id` = ? AND `resolution` = 'PENDING'";
|
||||
|
||||
outStatement = connection.prepareStatement(queryString);
|
||||
outStatement.setTimestamp(1, new java.sql.Timestamp(dateTime.getMillis()));
|
||||
outStatement.setTimestamp(1, new java.sql.Timestamp(dateTime.toEpochMilli()));
|
||||
outStatement.setString(2, bane.getCity().getHash());
|
||||
|
||||
return outStatement;
|
||||
|
||||
Reference in New Issue
Block a user