mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-01 05:58:00 +01:00
Added more TimeUnit (HOUR/MINUTE/SECOND)
This commit is contained in:
parent
2daccd9d9b
commit
4c889923f1
@ -4,16 +4,23 @@ import net.minestom.server.MinecraftServer;
|
||||
|
||||
public enum TimeUnit {
|
||||
|
||||
TICK, MILLISECOND;
|
||||
TICK, HOUR, MINUTE, SECOND, MILLISECOND;
|
||||
|
||||
public long toMilliseconds(long value) {
|
||||
switch (this) {
|
||||
case TICK:
|
||||
return MinecraftServer.TICK_MS * value;
|
||||
case HOUR:
|
||||
return value * 3_600_000;
|
||||
case MINUTE:
|
||||
return value * 60_000;
|
||||
case SECOND:
|
||||
return value * 1000;
|
||||
case MILLISECOND:
|
||||
return value;
|
||||
default:
|
||||
return -1; // Unexpected
|
||||
}
|
||||
return -1; // Unexpected
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user