Project cleanup pre merge.
This commit is contained in:
@@ -23,88 +23,88 @@ import org.joda.time.Seconds;
|
||||
|
||||
public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
||||
|
||||
private int buildingUUID;
|
||||
private Building treeOfLife;
|
||||
private int buildingUUID;
|
||||
private Building treeOfLife;
|
||||
|
||||
private int currentMineHour;
|
||||
private Seconds secondsLeft;
|
||||
private DateTime lateTime;
|
||||
private int late;
|
||||
private int currentMineHour;
|
||||
private Seconds secondsLeft;
|
||||
private DateTime lateTime;
|
||||
private int late;
|
||||
|
||||
/**
|
||||
* This constructor is used by NetMsgFactory. It attempts to deserialize the
|
||||
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
|
||||
* past the limit) then this constructor Throws that Exception to the
|
||||
* caller.
|
||||
*/
|
||||
public ArcMineWindowAvailableTimeMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCMINEWINDOWAVAILABLETIME, origin, reader);
|
||||
}
|
||||
/**
|
||||
* This constructor is used by NetMsgFactory. It attempts to deserialize the
|
||||
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
|
||||
* past the limit) then this constructor Throws that Exception to the
|
||||
* caller.
|
||||
*/
|
||||
public ArcMineWindowAvailableTimeMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCMINEWINDOWAVAILABLETIME, origin, reader);
|
||||
}
|
||||
|
||||
public ArcMineWindowAvailableTimeMsg(Building treeOfLife, int timeLeft) {
|
||||
super(Protocol.ARCMINEWINDOWAVAILABLETIME);
|
||||
this.treeOfLife = treeOfLife;
|
||||
this.buildingUUID = treeOfLife.getObjectUUID();
|
||||
}
|
||||
public ArcMineWindowAvailableTimeMsg(Building treeOfLife, int timeLeft) {
|
||||
super(Protocol.ARCMINEWINDOWAVAILABLETIME);
|
||||
this.treeOfLife = treeOfLife;
|
||||
this.buildingUUID = treeOfLife.getObjectUUID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt(); // Object type padding (We know it's a building)
|
||||
this.buildingUUID = reader.getInt();
|
||||
reader.getInt();
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt(); // Object type padding (We know it's a building)
|
||||
this.buildingUUID = reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Configures and pre-caches values for this message
|
||||
// so everything is already available during serialisation.
|
||||
// Configures and pre-caches values for this message
|
||||
// so everything is already available during serialisation.
|
||||
|
||||
public void configure() {
|
||||
public void configure() {
|
||||
|
||||
Guild guild;
|
||||
guild = this.treeOfLife.getGuild();
|
||||
Guild guild;
|
||||
guild = this.treeOfLife.getGuild();
|
||||
|
||||
if (guild != null)
|
||||
currentMineHour = guild.getMineTime();
|
||||
if (guild != null)
|
||||
currentMineHour = guild.getMineTime();
|
||||
|
||||
late = MBServerStatics.MINE_LATE_WINDOW;
|
||||
lateTime = DateTime.now();
|
||||
late = MBServerStatics.MINE_LATE_WINDOW;
|
||||
lateTime = DateTime.now();
|
||||
|
||||
if (late == 0)
|
||||
lateTime = lateTime.plusDays(1);
|
||||
if (late == 0)
|
||||
lateTime = lateTime.plusDays(1);
|
||||
|
||||
lateTime = lateTime.hourOfDay().setCopy(late);
|
||||
lateTime = lateTime.hourOfDay().setCopy(late);
|
||||
|
||||
late = ((late > 23) ? (late - 24) : late);
|
||||
secondsLeft = Seconds.secondsBetween(DateTime.now(), lateTime);
|
||||
}
|
||||
late = ((late > 23) ? (late - 24) : late);
|
||||
secondsLeft = Seconds.secondsBetween(DateTime.now(), lateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
writer.putInt(MBServerStatics.MINE_EARLY_WINDOW); //15);
|
||||
writer.putInt(late);
|
||||
writer.putInt(currentMineHour);
|
||||
writer.putInt(MBServerStatics.MINE_EARLY_WINDOW); //15);
|
||||
writer.putInt(late);
|
||||
writer.putInt(currentMineHour);
|
||||
|
||||
writer.putInt(this.treeOfLife.getObjectType().ordinal());
|
||||
writer.putInt(this.treeOfLife.getObjectUUID());
|
||||
writer.putInt(this.treeOfLife.getObjectType().ordinal());
|
||||
writer.putInt(this.treeOfLife.getObjectUUID());
|
||||
|
||||
writer.putInt((int)secondsLeft.getSeconds());
|
||||
}
|
||||
writer.putInt((int) secondsLeft.getSeconds());
|
||||
}
|
||||
|
||||
public int getBuildingUUID() {
|
||||
return buildingUUID;
|
||||
}
|
||||
public int getBuildingUUID() {
|
||||
return buildingUUID;
|
||||
}
|
||||
|
||||
public void setBuildingUUID(int buildingUUID) {
|
||||
this.buildingUUID = buildingUUID;
|
||||
}
|
||||
public void setBuildingUUID(int buildingUUID) {
|
||||
this.buildingUUID = buildingUUID;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user