Tiny cleanup to #expiry method in NodeBuilder

This commit is contained in:
Luck 2020-02-10 00:27:29 +00:00
parent 2eabe845d7
commit 6a96d40da4
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -31,6 +31,7 @@ import net.luckperms.api.node.metadata.NodeMetadataKey;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import java.time.Duration;
import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalAmount;
import java.util.Objects; import java.util.Objects;
@ -111,8 +112,7 @@ public interface NodeBuilder<N extends ScopedNode<N, B>, B extends NodeBuilder<N
throw new IllegalArgumentException("duration must be positive"); throw new IllegalArgumentException("duration must be positive");
} }
long seconds = Objects.requireNonNull(unit, "unit").toSeconds(duration); long seconds = Objects.requireNonNull(unit, "unit").toSeconds(duration);
long timeNow = System.currentTimeMillis() / 1000L; return expiry(Duration.ofSeconds(seconds));
return expiry(timeNow + seconds);
} }
/** /**