summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2015-01-25 14:39:20 +0000
committerThinkofdeath <thinkofdeath@spigotmc.org>2015-01-25 14:39:20 +0000
commit4b6df5adfeb92cd09428e59a963a6ee56d7d28d6 (patch)
treebcd3720e4d5d151dd09dec2f50f544f2787022f6
parentdf17927d453745954950c74574b6f480504017a7 (diff)
downloadcraftbukkit-4b6df5adfeb92cd09428e59a963a6ee56d7d28d6.tar
craftbukkit-4b6df5adfeb92cd09428e59a963a6ee56d7d28d6.tar.gz
craftbukkit-4b6df5adfeb92cd09428e59a963a6ee56d7d28d6.tar.lz
craftbukkit-4b6df5adfeb92cd09428e59a963a6ee56d7d28d6.tar.xz
craftbukkit-4b6df5adfeb92cd09428e59a963a6ee56d7d28d6.zip
SPIGOT-456: Provide equals & hashCode methods for CraftObjective and CraftTeam
-rw-r--r--src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java21
-rw-r--r--src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java21
2 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java
index 11713357..239ceca0 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java
@@ -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)));
+ }
+
+
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
index 5584353b..c4db4621 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
@@ -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)));
+ }
+
+
}