mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-07 00:48:28 +01:00
Updated UpdateOption.java so it doesn't break with the TimeUnit.java change
This commit is contained in:
parent
7b126f5d13
commit
7f9737d866
@ -2,6 +2,7 @@ package net.minestom.server.utils.time;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.time.temporal.TemporalUnit;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -11,11 +12,11 @@ import java.util.Objects;
|
|||||||
public class UpdateOption {
|
public class UpdateOption {
|
||||||
|
|
||||||
private final long value;
|
private final long value;
|
||||||
private final TimeUnit timeUnit;
|
private final TemporalUnit temporalUnit;
|
||||||
|
|
||||||
public UpdateOption(long value, @NotNull TimeUnit timeUnit) {
|
public UpdateOption(long value, @NotNull TemporalUnit temporalUnit) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.timeUnit = timeUnit;
|
this.temporalUnit = temporalUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getValue() {
|
public long getValue() {
|
||||||
@ -23,13 +24,13 @@ public class UpdateOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public TimeUnit getTimeUnit() {
|
public TemporalUnit getTemporalUnit() {
|
||||||
return timeUnit;
|
return temporalUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(value, timeUnit);
|
return Objects.hash(value, temporalUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -37,7 +38,7 @@ public class UpdateOption {
|
|||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
UpdateOption updateOption = (UpdateOption) o;
|
UpdateOption updateOption = (UpdateOption) o;
|
||||||
return Objects.equals(value, updateOption.value) && Objects.equals(timeUnit, updateOption.timeUnit);
|
return Objects.equals(value, updateOption.value) && Objects.equals(temporalUnit, updateOption.temporalUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,6 +47,6 @@ public class UpdateOption {
|
|||||||
* @return the converted milliseconds based on the time value and the unit
|
* @return the converted milliseconds based on the time value and the unit
|
||||||
*/
|
*/
|
||||||
public long toMilliseconds() {
|
public long toMilliseconds() {
|
||||||
return timeUnit.toMilliseconds(value);
|
return temporalUnit.getDuration().multipliedBy(value).toMillis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user