1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +01:00

Using primitives instead to save memory

This commit is contained in:
Zrips 2022-11-14 14:15:46 +02:00
parent c4ecee7840
commit 2bd257b563

View File

@ -7,10 +7,10 @@ public class BlockProtection {
private static long pre = (int) (System.currentTimeMillis() / 10000000000L) * 10000000000L;
private int id;
private Integer time;
private Integer recorded;
private int time = -1;
private int recorded = -1;
private DBAction action;
private Boolean paid;
private boolean paid = false;
private int x = 0;
private int y = 0;
private int z = 0;
@ -41,12 +41,12 @@ public class BlockProtection {
return time == -1L ? -1 : (int) ((time - pre) / 1000L);
}
private static long deconvert(Integer time) {
return time == null ? -1L : ((time.longValue() * 1000L) + pre);
private static long deconvert(int time) {
return (time * 1000L) + pre;
}
public void setTime(long time) {
this.time = time == -1 ? null : convert(time);
this.time = time == -1 ? -1 : convert(time);
this.recorded = convert(System.currentTimeMillis());
}
@ -65,11 +65,11 @@ public class BlockProtection {
}
public boolean isPaid() {
return paid == null || paid.booleanValue();
return paid;
}
public void setPaid(boolean paid) {
this.paid = !paid ? paid : null;
this.paid = paid;
}
public void setRecorded(long recorded) {