diff --git a/src/engine/db/handlers/dbGuildHandler.java b/src/engine/db/handlers/dbGuildHandler.java index 43d43593..b21ad7d1 100644 --- a/src/engine/db/handlers/dbGuildHandler.java +++ b/src/engine/db/handlers/dbGuildHandler.java @@ -19,6 +19,7 @@ import org.pmw.tinylog.Logger; import java.sql.ResultSet; import java.sql.SQLException; +import java.time.LocalDateTime; import java.util.ArrayList; public class dbGuildHandler extends dbHandlerBase { @@ -114,8 +115,12 @@ public class dbGuildHandler extends dbHandlerBase { return outputStr; } - - + public boolean SET_LAST_WOO_UPDATE(Guild guild, LocalDateTime lastEditTime) { + prepareCallable("UPDATE `obj_guild` SET `lastWooEditTime`=? WHERE `UID`=?"); + setLocalDateTime(1, lastEditTime); + setLong(2, (long) guild.getObjectUUID()); + return (executeUpdate() > 0); + } public ArrayList GET_GUILD_ALLIES(final int id) { prepareCallable("SELECT g.* FROM `obj_guild` g, `dyn_guild_allianceenemylist` l " diff --git a/src/engine/net/client/handlers/MineWindowChangeHandler.java b/src/engine/net/client/handlers/MineWindowChangeHandler.java index 351faed7..96312545 100644 --- a/src/engine/net/client/handlers/MineWindowChangeHandler.java +++ b/src/engine/net/client/handlers/MineWindowChangeHandler.java @@ -77,7 +77,7 @@ public class MineWindowChangeHandler extends AbstractClientMsgHandler { // Enforce 15hr restriction between WOO edits - if (LocalDateTime.now().isBefore(mineGuild.lastWooEditTime.plusHours(15))) { + if (LocalDateTime.now().isBefore(mineGuild.lastWooEditTime.plusHours(14))) { ErrorPopupMsg.sendErrorMsg(playerCharacter, "You must wait 15 hours between WOO changes."); return true; } @@ -98,6 +98,15 @@ public class MineWindowChangeHandler extends AbstractClientMsgHandler { mineGuild.setMineTime(newMineTime); mineGuild.lastWooEditTime = LocalDateTime.now(); + + // Update guild WOO timer for reboot persistence + + if (!DbManager.GuildQueries.SET_LAST_WOO_UPDATE(mineGuild, mineGuild.lastWooEditTime)) { + Logger.error("MineWindowChange", "Failed to update woo timer for guild " + mineGuild.getObjectUUID()); + ChatManager.chatGuildError(playerCharacter, "A Serious error has for to occurred."); + return true; + } + ChatManager.chatGuildInfo(playerCharacter, "Mine time updated."); return true;