diff --git a/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/Metadata.java b/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/Metadata.java index 244ea8423..f9c67ce35 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/Metadata.java +++ b/common/src/main/java/us/myles/ViaVersion/api/minecraft/metadata/Metadata.java @@ -1,5 +1,7 @@ package us.myles.ViaVersion.api.minecraft.metadata; +import java.util.Objects; + public class Metadata { private int id; private MetaType metaType; @@ -38,4 +40,32 @@ public class Metadata { public void setValue(Object value) { this.value = value; } + + @Override + public boolean equals(final Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Metadata metadata = (Metadata) o; + if (id != metadata.id) return false; + if (!Objects.equals(metaType, metadata.metaType)) return false; + return Objects.equals(value, metadata.value); + } + + @Override + public int hashCode() { + int result = id; + result = 31 * result + (metaType != null ? metaType.hashCode() : 0); + result = 31 * result + (value != null ? value.hashCode() : 0); + return result; + } + + @Override + public String toString() { + return "Metadata{" + + "id=" + id + + ", metaType=" + metaType + + ", value=" + value + + '}'; + } }