Cleanup of NextMindWindow logic.
This commit is contained in:
@@ -180,22 +180,22 @@ public class Mine extends AbstractGameObject {
|
|||||||
|
|
||||||
private void setNextMineWindow() {
|
private void setNextMineWindow() {
|
||||||
|
|
||||||
//default time, 9 pm est
|
int nextMineHour = MBServerStatics.MINE_EARLY_WINDOW;;
|
||||||
int mineHour = 21;
|
LocalDateTime nextOpenDate = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0);
|
||||||
|
|
||||||
|
// Use the new owners Mine WOO. If errant use Early window for this server.
|
||||||
|
|
||||||
if (this.owningGuild != null || this.owningGuild.isErrant() == false)
|
if (this.owningGuild != null || this.owningGuild.isErrant() == false)
|
||||||
mineHour = this.owningGuild.getNation().getMineTime();
|
nextMineHour = this.owningGuild.getMineTime();
|
||||||
int days = 1;
|
|
||||||
|
|
||||||
//midnight hours
|
if ((this.openDate.getHour() == 0 || this.openDate.getHour() == 24) &&
|
||||||
if (this.openDate.getHour() != 0 && this.openDate.getHour() != 24 && (this.openDate.getDayOfMonth() == LocalDateTime.now().getDayOfMonth()))
|
(this.owningGuild.getMineTime() != 0 && this.owningGuild.getMineTime() != 24))
|
||||||
if (mineHour == 0 || mineHour == 24)
|
nextOpenDate = nextOpenDate.withHour(nextMineHour);
|
||||||
days = 2;
|
else
|
||||||
|
nextOpenDate = nextOpenDate.withHour(nextMineHour).plusDays(1);
|
||||||
|
|
||||||
LocalDateTime newTime = this.openDate.plusDays(days).withHour(mineHour).withMinute(0).withSecond(0).withNano(0);
|
DbManager.MineQueries.CHANGE_MINE_TIME(this, nextOpenDate);
|
||||||
|
this.openDate = nextOpenDate;
|
||||||
DbManager.MineQueries.CHANGE_MINE_TIME(this, newTime);
|
|
||||||
this.openDate = newTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadAllMines() {
|
public static void loadAllMines() {
|
||||||
@@ -577,15 +577,8 @@ try{
|
|||||||
this.nationName = nation.getName();
|
this.nationName = nation.getName();
|
||||||
this.nationTag = nation.getGuildTag();
|
this.nationTag = nation.getGuildTag();
|
||||||
|
|
||||||
LocalDateTime guildDate = LocalDateTime.now().withHour(this.owningGuild.getMineTime()).withMinute(0).withSecond(0).withNano(0);
|
setNextMineWindow();
|
||||||
|
setLastChange(System.currentTimeMillis());
|
||||||
if (this.openDate.getDayOfMonth() == LocalDateTime.now().getDayOfMonth())
|
|
||||||
if (this.owningGuild.getMineTime() == 0 || this.owningGuild.getMineTime() == 24)
|
|
||||||
guildDate = guildDate.plusDays(1);
|
|
||||||
|
|
||||||
guildDate = guildDate.withHour(this.owningGuild.getMineTime()).withMinute(0).withSecond(0).withNano(0);
|
|
||||||
this.openDate = guildDate;
|
|
||||||
Mine.setLastChange(System.currentTimeMillis());
|
|
||||||
|
|
||||||
if (mineBuilding.getRank() < 1){
|
if (mineBuilding.getRank() < 1){
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user