From 2bd257b563aeb68137221074de2395c09513b008 Mon Sep 17 00:00:00 2001 From: Zrips Date: Mon, 14 Nov 2022 14:15:46 +0200 Subject: [PATCH] Using primitives instead to save memory --- .../jobs/container/BlockProtection.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/container/BlockProtection.java b/src/main/java/com/gamingmesh/jobs/container/BlockProtection.java index 3018767f..2a7de9d4 100644 --- a/src/main/java/com/gamingmesh/jobs/container/BlockProtection.java +++ b/src/main/java/com/gamingmesh/jobs/container/BlockProtection.java @@ -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) {