Use of Instant to track hotzone refresh times.
This commit is contained in:
@@ -12,10 +12,11 @@ import engine.net.client.msg.*;
|
||||
import engine.objects.City;
|
||||
import engine.objects.Mine;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Zone;
|
||||
import engine.server.world.WorldServer;
|
||||
import engine.session.Session;
|
||||
|
||||
import java.time.ZoneId;
|
||||
|
||||
/*
|
||||
* @Author:
|
||||
* @Summary: Processes application protocol message which displays
|
||||
@@ -35,7 +36,6 @@ public class CityDataHandler extends AbstractClientMsgHandler {
|
||||
boolean updateCity = false;
|
||||
Session playerSession;
|
||||
PlayerCharacter playerCharacter;
|
||||
Zone hotZone;
|
||||
Dispatch dispatch;
|
||||
|
||||
playerCharacter = origin.getPlayerCharacter();
|
||||
@@ -72,7 +72,7 @@ public class CityDataHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// If the hotZone has changed then update the client's map accordingly.
|
||||
|
||||
if (playerCharacter.getTimeStamp("hotzoneupdate") <= WorldServer.getLastHZChange() && ZoneManager.hotZone != null) {
|
||||
if (playerCharacter.getTimeStamp("hotzoneupdate") <= WorldServer.hotZoneLastUpdate.toEpochMilli() && ZoneManager.hotZone != null) {
|
||||
HotzoneChangeMsg hotzoneChangeMsg = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
|
||||
dispatch = Dispatch.borrow(playerCharacter, hotzoneChangeMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
@@ -10,17 +10,23 @@
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.math.FastMath;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.server.world.WorldServer;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
public class HotzoneChangeMsg extends ClientNetMsg {
|
||||
|
||||
private int zoneType;
|
||||
private int zoneID;
|
||||
private Duration endOfCycle;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
@@ -29,6 +35,11 @@ public class HotzoneChangeMsg extends ClientNetMsg {
|
||||
super(Protocol.ARCHOTZONECHANGE);
|
||||
this.zoneType = zoneType;
|
||||
this.zoneID = zoneID;
|
||||
|
||||
int hotZoneDuration = Integer.parseInt(ConfigManager.MB_HOTZONE_DURATION.getValue());
|
||||
|
||||
endOfCycle = Duration.between(WorldServer.hotZoneLastUpdate, WorldServer.hotZoneLastUpdate.plusSeconds(hotZoneDuration * 3600));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,7 +60,7 @@ public class HotzoneChangeMsg extends ClientNetMsg {
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.zoneType);
|
||||
writer.putInt(this.zoneID);
|
||||
writer.putInt(FastMath.secondsUntilNextHour());
|
||||
writer.putInt((int) endOfCycle.getSeconds());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user