mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 20:50:41 +01:00
SPIGOT-456: Provide equals & hashCode methods for CraftObjective and CraftTeam
This commit is contained in:
parent
df17927d45
commit
4b6df5adfe
2 changed files with 42 additions and 0 deletions
|
@ -113,4 +113,25 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective
|
||||||
|
|
||||||
return getScoreboard();
|
return getScoreboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 31 * hash + (this.objective != null ? this.objective.hashCode() : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final CraftObjective other = (CraftObjective) obj;
|
||||||
|
return !(this.objective != other.objective && (this.objective == null || !this.objective.equals(other.objective)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,4 +194,25 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||||
|
|
||||||
return getScoreboard();
|
return getScoreboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 43 * hash + (this.team != null ? this.team.hashCode() : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final CraftTeam other = (CraftTeam) obj;
|
||||||
|
return !(this.team != other.team && (this.team == null || !this.team.equals(other.team)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue