diff --git a/src/main/java/net/frozenorb/apiv3/route/grants/POSTGrants.java b/src/main/java/net/frozenorb/apiv3/route/grants/POSTGrants.java index 5991f6a..f09ea0e 100644 --- a/src/main/java/net/frozenorb/apiv3/route/grants/POSTGrants.java +++ b/src/main/java/net/frozenorb/apiv3/route/grants/POSTGrants.java @@ -65,8 +65,9 @@ public final class POSTGrants implements Handler { Instant expiresAt = null; - if (requestBody.containsKey("expiresAt") && requestBody.getLong("expiresAt") != -1) { - expiresAt = Instant.ofEpochMilli(requestBody.getLong("expiresAt")); + if (requestBody.containsKey("expiresIn") && requestBody.getLong("expiresIn") != -1) { + long expiresInMillis = requestBody.getLong("expiresIn") * 1000; + expiresAt = Instant.ofEpochMilli(System.currentTimeMillis() + expiresInMillis); } if (expiresAt != null && expiresAt.isBefore(Instant.now())) { diff --git a/src/main/java/net/frozenorb/apiv3/route/ipBans/POSTIpBans.java b/src/main/java/net/frozenorb/apiv3/route/ipBans/POSTIpBans.java index 82f2b08..364a65c 100644 --- a/src/main/java/net/frozenorb/apiv3/route/ipBans/POSTIpBans.java +++ b/src/main/java/net/frozenorb/apiv3/route/ipBans/POSTIpBans.java @@ -35,8 +35,9 @@ public final class POSTIpBans implements Handler { Instant expiresAt = null; - if (requestBody.containsKey("expiresAt") && requestBody.getLong("expiresAt") != -1) { - expiresAt = Instant.ofEpochMilli(requestBody.getLong("expiresAt")); + if (requestBody.containsKey("expiresIn") && requestBody.getLong("expiresIn") != -1) { + long expiresInMillis = requestBody.getLong("expiresIn") * 1000; + expiresAt = Instant.ofEpochMilli(System.currentTimeMillis() + expiresInMillis); } if (expiresAt != null && expiresAt.isBefore(Instant.now())) { diff --git a/src/main/java/net/frozenorb/apiv3/route/punishments/POSTPunishments.java b/src/main/java/net/frozenorb/apiv3/route/punishments/POSTPunishments.java index 8e91985..2840158 100644 --- a/src/main/java/net/frozenorb/apiv3/route/punishments/POSTPunishments.java +++ b/src/main/java/net/frozenorb/apiv3/route/punishments/POSTPunishments.java @@ -63,8 +63,9 @@ public final class POSTPunishments implements Handler { Instant expiresAt = null; - if (requestBody.containsKey("expiresAt") && requestBody.getLong("expiresAt") != -1) { - expiresAt = Instant.ofEpochMilli(requestBody.getLong("expiresAt")); + if (requestBody.containsKey("expiresIn") && requestBody.getLong("expiresIn") != -1) { + long expiresInMillis = requestBody.getLong("expiresIn") * 1000; + expiresAt = Instant.ofEpochMilli(System.currentTimeMillis() + expiresInMillis); } if (expiresAt != null && expiresAt.isBefore(Instant.now())) {