mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-11-14 19:34:58 -05:00
Add equals and hashcode checks that include value
This commit is contained in:
parent
62492c961a
commit
b8e980163c
1 changed files with 17 additions and 0 deletions
|
@ -219,4 +219,21 @@ public abstract class EntityMetadata<T> {
|
|||
public String toString() {
|
||||
return "EntityMetadata(id=" + id + ", type=" + type + ", value=" + getValue().toString() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof EntityMetadata)) {
|
||||
return false;
|
||||
}
|
||||
EntityMetadata<?> that = (EntityMetadata<?>) o;
|
||||
return this.id == that.id && this.type == that.type && Objects.equals(this.getValue(), that.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, type, getValue());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue