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(); 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() { public boolean shouldSave() {
return hologram || particles || infinity || permPlaced; 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 @Override
public String toString() { public String toString() {
return "UAnvil:{" return "UAnvil{" +
+ "Location:{" "hologramId='" + hologramId + '\'' +
+ "World:\"" + location.getWorld().getName() + "\"," ", location=" + location +
+ "X:" + location.getBlockX() + "," ", hologram=" + hologram +
+ "Y:" + location.getBlockY() + "," ", particles=" + particles +
+ "Z:" + location.getBlockZ() ", infinity=" + infinity +
+ "}" ", permPlaced=" + permPlaced +
+ "}"; '}';
} }
} }