13
0
geforkt von Mirrors/Paper

SPIGOT-456: Provide equals & hashCode methods for CraftObjective and CraftTeam

Dieser Commit ist enthalten in:
Thinkofdeath 2015-01-25 14:39:20 +00:00
Ursprung df17927d45
Commit 4b6df5adfe
2 geänderte Dateien mit 42 neuen und 0 gelöschten Zeilen
src/main/java/org/bukkit/craftbukkit/scoreboard

Datei anzeigen

@ -113,4 +113,25 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective
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)));
}
}

Datei anzeigen

@ -194,4 +194,25 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
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)));
}
}