Browse Source

Removed 30 lines of logic that had no business in a result set constructor.

master
MagicBot 2 years ago
parent
commit
df09b6e38b
  1. 41
      src/engine/objects/Mine.java

41
src/engine/objects/Mine.java

@ -35,6 +35,7 @@ import org.pmw.tinylog.Logger;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -141,41 +142,11 @@ public class Mine extends AbstractGameObject {
this.lastClaimerID = 0; this.lastClaimerID = 0;
this.lastClaimerSessionID = null; this.lastClaimerSessionID = null;
java.sql.Timestamp mineTimeStamp = rs.getTimestamp("mine_openDate");
Timestamp mineOpenDateTime = rs.getTimestamp("mine_openDate");
Building building = BuildingManager.getBuildingFromCache(this.buildingID); if (mineOpenDateTime != null)
this.openDate = mineOpenDateTime.toLocalDateTime();
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;
}
} }
@ -252,10 +223,6 @@ try{
*/ */
private void initializeMineTime(){ private void initializeMineTime(){
//Mine time has already been set at loading from the database. skip.
if (this.openDate != null)
return;
Guild nation = null; Guild nation = null;

Loading…
Cancel
Save