Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 00:50:13 +01:00
Add toString, equals, and hashCode to Metadata
Dieser Commit ist enthalten in:
Ursprung
a60340f330
Commit
eb9d913cb6
@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren