Merge remote-tracking branch 'origin/minetime_bugfix' into post-wipe-merge
This commit is contained in:
@@ -40,7 +40,10 @@ import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@@ -79,6 +82,7 @@ public class Guild extends AbstractWorldObject {
|
||||
private String hash;
|
||||
private boolean ownerIsNPC;
|
||||
|
||||
public LocalDateTime lastWooEditTime;
|
||||
public HashMap<Integer,GuildAlliances> guildAlliances = new HashMap<>();
|
||||
|
||||
/**
|
||||
@@ -176,8 +180,13 @@ public class Guild extends AbstractWorldObject {
|
||||
this.teleportMax = rs.getInt("teleportMax");
|
||||
|
||||
this.mineTime = rs.getInt("mineTime");
|
||||
this.hash = rs.getString("hash");
|
||||
|
||||
Timestamp lastWooRequest = rs.getTimestamp("lastWooEditTime");
|
||||
|
||||
if (lastWooRequest != null)
|
||||
this.lastWooEditTime = lastWooRequest.toLocalDateTime();
|
||||
|
||||
this.hash = rs.getString("hash");
|
||||
}
|
||||
|
||||
public void setNation(Guild nation) {
|
||||
|
||||
@@ -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,47 +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);
|
||||
|
||||
if (LocalDateTime.now().isAfter(this.openDate.plusHours(1))){
|
||||
this.openDate = this.openDate.plusDays(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//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();
|
||||
|
||||
}
|
||||
|
||||
@@ -258,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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user