mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-04 23:47:59 +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 java.time.temporal.TemporalUnit;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@ -11,11 +12,11 @@ import java.util.Objects;
|
||||
public class UpdateOption {
|
||||
|
||||
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.timeUnit = timeUnit;
|
||||
this.temporalUnit = temporalUnit;
|
||||
}
|
||||
|
||||
public long getValue() {
|
||||
@ -23,13 +24,13 @@ public class UpdateOption {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public TimeUnit getTimeUnit() {
|
||||
return timeUnit;
|
||||
public TemporalUnit getTemporalUnit() {
|
||||
return temporalUnit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(value, timeUnit);
|
||||
return Objects.hash(value, temporalUnit);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -37,7 +38,7 @@ public class UpdateOption {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
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
|
||||
*/
|
||||
public long toMilliseconds() {
|
||||
return timeUnit.toMilliseconds(value);
|
||||
return temporalUnit.getDuration().multipliedBy(value).toMillis();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user