mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-21 15:41:38 +01:00
Added UpdateOption#toDuration method
This commit is contained in:
parent
67dc8bf996
commit
580509c420
@ -2,6 +2,7 @@ package net.minestom.server.utils.time;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
import java.time.temporal.TemporalUnit;
|
import java.time.temporal.TemporalUnit;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -49,4 +50,8 @@ public class UpdateOption {
|
|||||||
public long toMilliseconds() {
|
public long toMilliseconds() {
|
||||||
return temporalUnit.getDuration().multipliedBy(value).toMillis();
|
return temporalUnit.getDuration().multipliedBy(value).toMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Duration toDuration() {
|
||||||
|
return Duration.ofMillis(toMilliseconds());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user