Added hashCode and equal to main server objects

This commit is contained in:
magenoxx 2017-04-20 20:06:52 +03:00
parent 21eb420c16
commit 27a454f042
14 changed files with 614 additions and 31 deletions

View file

@ -89,4 +89,27 @@ public class CombatGroupView implements Serializable {
public UUID getDefenderId() {
return defenderId;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final CombatGroupView that = (CombatGroupView) o;
if (!getAttackers().equals(that.getAttackers())) return false;
if (!getBlockers().equals(that.getBlockers())) return false;
if (!getDefenderName().equals(that.getDefenderName())) return false;
return getDefenderId().equals(that.getDefenderId());
}
@Override
public int hashCode() {
int result = getAttackers().hashCode();
result = 31 * result + getBlockers().hashCode();
result = 31 * result + getDefenderName().hashCode();
result = 31 * result + getDefenderId().hashCode();
return result;
}
}