forked from MagicBane/Server
Complete JodaTime -> java.time migration (remaining objects, db handlers, net msg, jobs) + QC pass; untrack working reference files
This commit is contained in:
1 parent
efd35e89f1
commit
93eb77fcc8
26 files changed
+160
-426
No files matched your search
@@ -18,9 +18,6 @@ import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.*;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Period;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Set;
|
||||
@@ -397,37 +394,33 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
else
|
||||
writer.put((byte) 0);
|
||||
|
||||
DateTime placedOn = bane.getLiveDate();
|
||||
LocalDateTime placedOn = bane.getLiveDate();
|
||||
|
||||
if (placedOn == null)
|
||||
placedOn = new DateTime(DateTime.now());
|
||||
placedOn = LocalDateTime.now();
|
||||
|
||||
//set Calander to date of bane live.
|
||||
DateTime now = DateTime.now();
|
||||
DateTime defaultTime = new DateTime(bane.getPlacementDate());
|
||||
DateTime playerEnterWorldTime = new DateTime(this.assetManager.getTimeStamp("EnterWorld"));
|
||||
Period period = new Period(playerEnterWorldTime.getMillis(), now.getMillis());
|
||||
int hoursLoggedIn = period.getHours();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime defaultTime = bane.getPlacementDate();
|
||||
LocalDateTime playerEnterWorldTime = LocalDateTime.ofInstant(java.time.Instant.ofEpochMilli(this.assetManager.getTimeStamp("EnterWorld")), ZoneId.systemDefault());
|
||||
int hoursLoggedIn = (int) java.time.Duration.between(playerEnterWorldTime, now).toHours();
|
||||
hoursLoggedIn = hoursLoggedIn < 0 ? 0 : hoursLoggedIn;
|
||||
|
||||
defaultTime = defaultTime.plusDays(2);
|
||||
defaultTime = defaultTime.hourOfDay().setCopy(22);
|
||||
defaultTime = defaultTime.minuteOfHour().setCopy(0);
|
||||
defaultTime = defaultTime.secondOfMinute().setCopy(0);
|
||||
defaultTime = defaultTime.plusDays(2).withHour(22).withMinute(0).withSecond(0).withNano(0);
|
||||
|
||||
long curTime = now.getMillis();
|
||||
long curTime = now.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||
long timeLeft = 0;
|
||||
|
||||
if (bane.getLiveDate() != null)
|
||||
timeLeft = bane.getLiveDate().getMillis() - curTime;
|
||||
timeLeft = bane.getLiveDate().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() - curTime;
|
||||
else
|
||||
timeLeft = defaultTime.getMillis() - curTime + 1000;
|
||||
timeLeft = defaultTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() - curTime + 1000;
|
||||
|
||||
//DO not touch these. They are static formula's until i get the correct converter for SB Time.
|
||||
|
||||
writer.put((byte) placedOn.dayOfMonth().get());
|
||||
writer.put((byte) placedOn.monthOfYear().get());
|
||||
writer.putInt(placedOn.year().get() - 1900);
|
||||
writer.put((byte) placedOn.getDayOfMonth());
|
||||
writer.put((byte) placedOn.getMonthValue());
|
||||
writer.putInt(placedOn.getYear() - 1900);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
|
||||
Reference in new issue
Block a user