bane system work

This commit is contained in:
2024-12-31 13:59:23 -06:00
parent e21ebc75ee
commit cd767dc68c
2 changed files with 27 additions and 0 deletions
+21
View File
@@ -223,4 +223,25 @@ public class dbBaneHandler extends dbHandlerBase {
return true;
}
public DateTime getLiveDate(int cityUUID) {
try (Connection connection = DbManager.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?")) {
statement.setInt(1, cityUUID);
try (ResultSet rs = statement.executeQuery()) {
if (rs.next()) {
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
if (liveDateTimestamp != null) {
return new DateTime(liveDateTimestamp.getTime());
}
}
}
} catch (SQLException e) {
Logger.error(e);
}
return null; // Return null if liveDate is not found or an error occurs
}
}
+6
View File
@@ -376,6 +376,7 @@ public class Contract extends AbstractGameObject {
bane.setLiveDate_NEW(bane.getLiveDate().plusDays(updateBaneDay));
}
}
bane.setLiveDate(DbManager.BaneQueries.getLiveDate(bane.getCityUUID()));
}
if (updateBaneTime > 0) {
if(DbManager.BaneQueries.SET_BANE_TIME_NEW(updateBaneTime,bane.getCityUUID())){
@@ -386,6 +387,7 @@ public class Contract extends AbstractGameObject {
bane.setLiveDate_NEW(bane.getLiveDate().withHourOfDay(12 + updateBaneTime));
}
}
bane.setLiveDate(DbManager.BaneQueries.getLiveDate(bane.getCityUUID()));
}
if (updateBaneCap > 0) {
if(DbManager.BaneQueries.SET_BANE_CAP_NEW(updateBaneCap,bane.getCityUUID())){
@@ -394,6 +396,10 @@ public class Contract extends AbstractGameObject {
}
}
if(bane.timeSet && bane.daySet && bane.capSet){
bane.getSiegePhase();
}
return vd;
}