adding equals and hashcode in ClientSettings, ClientSettingsWrapper and SkinParts (#765)

* adding equals and hashcode in ClientSettings, ClientSettingsWrapper and SkinParts

* fixing format
This commit is contained in:
foxley
2022-06-23 05:37:38 +02:00
committed by GitHub
parent 93df65fdfb
commit 86c65f3910
3 changed files with 73 additions and 0 deletions

View File

@@ -7,6 +7,9 @@
package com.velocitypowered.api.proxy.player;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class SkinParts {
private final byte bitmask;
@@ -42,4 +45,21 @@ public final class SkinParts {
public boolean hasHat() {
return ((bitmask >> 6) & 1) == 1;
}
@Override
public boolean equals(@Nullable final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final SkinParts skinParts = (SkinParts) o;
return bitmask == skinParts.bitmask;
}
@Override
public int hashCode() {
return Objects.hash(bitmask);
}
}