Storing lastWooEditTime for guilds in obj_guild table. Requires Schema Change.

This commit is contained in:
2023-01-07 11:03:07 -05:00
parent 83b514a05f
commit 302358e31c
2 changed files with 11 additions and 1 deletions
@@ -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.");
+5 -1
View File
@@ -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<Integer,GuildAlliances> 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) {