diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index e2b435f1..cd367251 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -35,6 +35,7 @@ import org.pmw.tinylog.Logger; import java.net.UnknownHostException; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.concurrent.ConcurrentHashMap; @@ -141,41 +142,11 @@ public class Mine extends AbstractGameObject { this.lastClaimerID = 0; this.lastClaimerSessionID = null; - java.sql.Timestamp mineTimeStamp = rs.getTimestamp("mine_openDate"); - - - Building building = BuildingManager.getBuildingFromCache(this.buildingID); - - if (mineTimeStamp == null && (this.owningGuild == null || this.owningGuild.isErrant() || building.getRank() < 1)){ - if (building != null){ - String zoneName = building.getParentZone().getName(); - String parentZoneName = building.getParentZone().getParent().getName(); - Logger.info(zoneName + " in " + parentZoneName + " has a dirty mine, setting active."); - } - this.dirtyMine = true; - openDate = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0); - return; - }else if (this.owningGuild.isErrant() || nation.isErrant()){ - openDate = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0); - return; - }else if (mineTimeStamp == null){ - - this.openDate = LocalDateTime.now().withHour(mineTime).withMinute(0).withSecond(0).withNano(0); - - if (LocalDateTime.now().isAfter(this.openDate.plusHours(1))) - this.openDate = this.openDate.plusDays(1); - return; - }else - this.openDate = mineTimeStamp.toLocalDateTime().withHour(mineTime); - - //after 1 day... - if (this.openDate.getDayOfYear() - LocalDateTime.now().getDayOfYear() > 1){ - this.openDate = this.openDate.withDayOfYear(LocalDateTime.now().getDayOfYear()); - if (LocalDateTime.now().isAfter(this.openDate.plusHours(1))) - this.openDate = this.openDate.plusDays(1); - return; - } + Timestamp mineOpenDateTime = rs.getTimestamp("mine_openDate"); + + if (mineOpenDateTime != null) + this.openDate = mineOpenDateTime.toLocalDateTime(); } @@ -252,10 +223,6 @@ try{ */ private void initializeMineTime(){ - //Mine time has already been set at loading from the database. skip. - - if (this.openDate != null) - return; Guild nation = null;