Migrate dbWarehouseHandler.java from JodaTime to java.time.*
Completed migration of JodaTime references in dbWarehouseHandler.java:
This commit is contained in:
1 parent
70b941239a
commit
8d6457b91c
2 files changed
+91
-5
No files matched your search
@@ -16,7 +16,7 @@ import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -55,7 +55,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
public ArrayList<AbstractGameObject> CREATE_WAREHOUSE(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
||||
Vector3fImmutable location, float meshScale, int currentHP,
|
||||
ProtectionState protectionState, int currentGold, int rank,
|
||||
DateTime upgradeDate, int blueprintUUID, float w, float rotY) {
|
||||
Instant upgradeDate, int blueprintUUID, float w, float rotY) {
|
||||
|
||||
ArrayList<AbstractGameObject> warehouseList = new ArrayList<>();
|
||||
|
||||
@@ -76,7 +76,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
preparedStatement.setInt(12, rank);
|
||||
|
||||
if (upgradeDate != null)
|
||||
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.getMillis()));
|
||||
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.toEpochMilli()));
|
||||
else
|
||||
preparedStatement.setNull(13, java.sql.Types.DATE);
|
||||
|
||||
@@ -487,7 +487,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount, DateTime date) {
|
||||
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount, Instant date) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse_transactions` (`warehouseUID`, `targetType`,`targetUID`, `type`,`resource`,`amount`,`date` ) VALUES (?,?,?,?,?,?,?)")) {
|
||||
@@ -498,7 +498,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
preparedStatement.setString(4, transactionType.name());
|
||||
preparedStatement.setString(5, resource.name());
|
||||
preparedStatement.setInt(6, amount);
|
||||
preparedStatement.setTimestamp(7, new java.sql.Timestamp(date.getMillis()));
|
||||
preparedStatement.setTimestamp(7, new java.sql.Timestamp(date.toEpochMilli()));
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
|
||||
Reference in new issue
Block a user