2 * Decompiled with CFR 0.151.
4 package net
.encode
.wurmesp
.util
;
6 import java
.util
.HashMap
;
8 public class CronoManager
{
9 private long timelapse
;
11 private long remaining
;
15 public CronoManager(long timelapse
) {
16 this.timelapse
= timelapse
;
17 this.time
= System
.currentTimeMillis();
18 this.future
= this.time
+ this.timelapse
;
19 this.last
= this.remaining
= (this.future
- System
.currentTimeMillis()) / 1000L;
22 public void restart(long timelapse
) {
23 this.timelapse
= timelapse
;
24 this.time
= System
.currentTimeMillis();
25 this.future
= this.time
+ this.timelapse
;
26 this.last
= this.remaining
= (this.future
- System
.currentTimeMillis()) / 1000L;
29 public HashMap
<CronoDataType
, Long
> getTime() {
30 this.last
= this.remaining
= (this.future
- System
.currentTimeMillis()) / 1000L;
31 long days
= (long)Math
.floor(this.remaining
/ 86400L);
32 long hours
= (long)Math
.floor(this.remaining
% 86400L / 3600L);
33 long minutes
= (long)Math
.floor(this.remaining
% 86400L % 3600L / 60L);
34 long seconds
= (long)Math
.floor(this.remaining
% 86400L % 3600L % 60L);
35 HashMap
<CronoDataType
, Long
> returnedTime
= new HashMap
<CronoDataType
, Long
>();
36 returnedTime
.put(CronoDataType
.DAYS
, days
);
37 returnedTime
.put(CronoDataType
.HOURS
, hours
);
38 returnedTime
.put(CronoDataType
.MINUTES
, minutes
);
39 returnedTime
.put(CronoDataType
.SECONDS
, seconds
);
43 public int getDays() {
44 this.last
= this.remaining
= (this.future
- System
.currentTimeMillis()) / 1000L;
45 long days
= (long)Math
.floor(this.remaining
/ 86400L);
49 public int getHours() {
50 this.last
= this.remaining
= (this.future
- System
.currentTimeMillis()) / 1000L;
51 long hours
= (long)Math
.floor(this.remaining
% 86400L / 3600L);
55 public int getMinutes() {
56 this.last
= this.remaining
= (this.future
- System
.currentTimeMillis()) / 1000L;
57 long minutes
= (long)Math
.floor(this.remaining
% 86400L % 3600L / 60L);
61 public int getSeconds() {
62 this.last
= this.remaining
= (this.future
- System
.currentTimeMillis()) / 1000L;
63 long seconds
= (long)Math
.floor(this.remaining
% 86400L % 3600L % 60L);
67 public boolean hasNext() {
68 this.remaining
= (this.future
- System
.currentTimeMillis()) / 1000L;
69 return this.remaining
< this.last
;
72 public boolean hasEnded() {
73 return System
.currentTimeMillis() > this.future
;
76 public static enum CronoDataType
{