Equals & hashcode overrides

This commit is contained in:
LeoDog896 2021-04-06 15:25:18 -04:00
parent 0bb8144d33
commit 9d1d60cdcd

View File

@ -2,6 +2,8 @@ package net.minestom.server.utils.time;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
public class UpdateOption {
private final long value;
@ -20,4 +22,17 @@ public class UpdateOption {
public TimeUnit getTimeUnit() {
return timeUnit;
}
@Override
public int hashCode() {
return Objects.hash(value, timeUnit);
}
@Override
public boolean equals(Object o) {
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);
}
}