Browse Source

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

master
MagicBot 2 years ago
parent
commit
302358e31c
  1. 6
      src/engine/net/client/handlers/MineWindowChangeHandler.java
  2. 6
      src/engine/objects/Guild.java

6
src/engine/net/client/handlers/MineWindowChangeHandler.java

@ -28,6 +28,8 @@ import engine.objects.PlayerCharacter; @@ -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 { @@ -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.");

6
src/engine/objects/Guild.java

@ -36,11 +36,14 @@ import engine.net.client.msg.UpdateClientAlliancesMsg; @@ -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 { @@ -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 { @@ -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) {

Loading…
Cancel
Save