mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 16:37:38 +01:00
Reuse equals code
This commit is contained in:
parent
408134bd63
commit
2f7ba7e514
@ -36,9 +36,7 @@ final class VecImpl {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
return VecImpl.equals(this, o);
|
||||||
if (!(o instanceof Vec)) return false;
|
|
||||||
return VecImpl.equals(this, (Vec) o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -82,9 +80,7 @@ final class VecImpl {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
return VecImpl.equals(this, o);
|
||||||
if (!(o instanceof Vec)) return false;
|
|
||||||
return VecImpl.equals(this, (Vec) o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -127,9 +123,7 @@ final class VecImpl {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
return VecImpl.equals(this, o);
|
||||||
if (!(o instanceof Vec)) return false;
|
|
||||||
return VecImpl.equals(this, (Vec) o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -143,7 +137,10 @@ final class VecImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean equals(@NotNull Vec vec1, @NotNull Vec vec2) {
|
private static boolean equals(@NotNull Vec vec1, Object o) {
|
||||||
|
if (vec1 == o) return true;
|
||||||
|
if (!(o instanceof Vec)) return false;
|
||||||
|
Vec vec2 = (Vec) o;
|
||||||
return Double.compare(vec1.x(), vec2.x()) == 0 &&
|
return Double.compare(vec1.x(), vec2.x()) == 0 &&
|
||||||
Double.compare(vec1.y(), vec2.y()) == 0 &&
|
Double.compare(vec1.y(), vec2.y()) == 0 &&
|
||||||
Double.compare(vec1.z(), vec2.z()) == 0;
|
Double.compare(vec1.z(), vec2.z()) == 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user