bane system work
This commit is contained in:
@@ -223,4 +223,25 @@ public class dbBaneHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
return true;
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -376,6 +376,7 @@ public class Contract extends AbstractGameObject {
|
|||||||
bane.setLiveDate_NEW(bane.getLiveDate().plusDays(updateBaneDay));
|
bane.setLiveDate_NEW(bane.getLiveDate().plusDays(updateBaneDay));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bane.setLiveDate(DbManager.BaneQueries.getLiveDate(bane.getCityUUID()));
|
||||||
}
|
}
|
||||||
if (updateBaneTime > 0) {
|
if (updateBaneTime > 0) {
|
||||||
if(DbManager.BaneQueries.SET_BANE_TIME_NEW(updateBaneTime,bane.getCityUUID())){
|
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_NEW(bane.getLiveDate().withHourOfDay(12 + updateBaneTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bane.setLiveDate(DbManager.BaneQueries.getLiveDate(bane.getCityUUID()));
|
||||||
}
|
}
|
||||||
if (updateBaneCap > 0) {
|
if (updateBaneCap > 0) {
|
||||||
if(DbManager.BaneQueries.SET_BANE_CAP_NEW(updateBaneCap,bane.getCityUUID())){
|
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;
|
return vd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user