Reimplements #toString, #equals, #hashCode in UAnvil

This commit is contained in:
Christian Koop 2022-02-21 19:10:12 +01:00
parent 1576a025b7
commit bbd877100f
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3

View File

@ -108,33 +108,38 @@ public class UAnvil {
return location.getWorld();
}
@Override
public int hashCode() {
return 31 * (location == null ? 0 : location.hashCode());
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (!(obj instanceof UAnvil)) return false;
UAnvil other = (UAnvil) obj;
return Objects.equals(location, other.location);
}
public boolean shouldSave() {
return hologram || particles || infinity || permPlaced;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UAnvil uAnvil = (UAnvil) o;
return hologram == uAnvil.hologram &&
particles == uAnvil.particles &&
infinity == uAnvil.infinity &&
permPlaced == uAnvil.permPlaced &&
Objects.equals(hologramId, uAnvil.hologramId) &&
Objects.equals(location, uAnvil.location);
}
@Override
public int hashCode() {
return Objects.hash(hologramId, location, hologram, particles, infinity, permPlaced);
}
@Override
public String toString() {
return "UAnvil:{"
+ "Location:{"
+ "World:\"" + location.getWorld().getName() + "\","
+ "X:" + location.getBlockX() + ","
+ "Y:" + location.getBlockY() + ","
+ "Z:" + location.getBlockZ()
+ "}"
+ "}";
return "UAnvil{" +
"hologramId='" + hologramId + '\'' +
", location=" + location +
", hologram=" + hologram +
", particles=" + particles +
", infinity=" + infinity +
", permPlaced=" + permPlaced +
'}';
}
}