diff --git a/src/engine/net/client/handlers/MineWindowChangeHandler.java b/src/engine/net/client/handlers/MineWindowChangeHandler.java index 4edc8a2b..5be628c6 100644 --- a/src/engine/net/client/handlers/MineWindowChangeHandler.java +++ b/src/engine/net/client/handlers/MineWindowChangeHandler.java @@ -28,6 +28,8 @@ import engine.objects.PlayerCharacter; import engine.server.MBServerStatics; import org.pmw.tinylog.Logger; +import java.time.LocalDateTime; + /* * @Author: * @Summary: Processes requests to change a mine's opendate @@ -73,15 +75,19 @@ public class MineWindowChangeHandler extends AbstractClientMsgHandler { newMineTime = mineWindowChangeMsg.getTime(); //hodge podge sanity check to make sure they don't set it before early window and is not set at late window. + if (newMineTime < MBServerStatics.MINE_EARLY_WINDOW && newMineTime != MBServerStatics.MINE_LATE_WINDOW) return true; //invalid mine time, must be in range + // Update guild mine time + if (!DbManager.GuildQueries.UPDATE_MINETIME(mineGuild.getObjectUUID(), newMineTime)) { Logger.error("MineWindowChange", "Failed to update mine time for guild " + mineGuild.getObjectUUID()); ChatManager.chatGuildError(playerCharacter, "Failed to update the mine time"); return true; } + mineGuild.setMineTime(newMineTime); ChatManager.chatGuildInfo(playerCharacter, "Mine time updated."); diff --git a/src/engine/objects/Guild.java b/src/engine/objects/Guild.java index e28009af..2f7abea2 100644 --- a/src/engine/objects/Guild.java +++ b/src/engine/objects/Guild.java @@ -36,11 +36,14 @@ import engine.net.client.msg.UpdateClientAlliancesMsg; import engine.net.client.msg.guild.GuildInfoMsg; import engine.server.MBServerStatics; import org.joda.time.DateTime; +import org.joda.time.LocalDateTime; import org.pmw.tinylog.Logger; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Timestamp; 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 Timestamp lastWooEditTime; public HashMap guildAlliances = new HashMap<>(); /** @@ -176,8 +180,8 @@ public class Guild extends AbstractWorldObject { this.teleportMax = rs.getInt("teleportMax"); this.mineTime = rs.getInt("mineTime"); + this.lastWooEditTime = rs.getTimestamp("lastWooEditTime"); this.hash = rs.getString("hash"); - } public void setNation(Guild nation) {