geforkt von Mirrors/Paper
SPIGOT-456: Provide equals & hashCode methods for CraftObjective and CraftTeam
Dieser Commit ist enthalten in:
Ursprung
df17927d45
Commit
4b6df5adfe
src/main/java/org/bukkit/craftbukkit/scoreboard
@ -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)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren