diff options
author | md_5 <git@md-5.net> | 2016-03-12 13:08:44 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2016-03-12 13:08:44 +1100 |
commit | 650ae8fbe37371aaabb503fee614ec7e3193635d (patch) | |
tree | 6ed272e5e1be321bbc6fd48c6b7661d7152d04bf /src | |
parent | 73090659cd1be68f81662ea6d7035d6336e54857 (diff) | |
download | bukkit-650ae8fbe37371aaabb503fee614ec7e3193635d.tar bukkit-650ae8fbe37371aaabb503fee614ec7e3193635d.tar.gz bukkit-650ae8fbe37371aaabb503fee614ec7e3193635d.tar.lz bukkit-650ae8fbe37371aaabb503fee614ec7e3193635d.tar.xz bukkit-650ae8fbe37371aaabb503fee614ec7e3193635d.zip |
Add equals / hashCode for PotionData
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/potion/PotionData.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/potion/PotionData.java b/src/main/java/org/bukkit/potion/PotionData.java index 7e9ce38a..6e8139a9 100644 --- a/src/main/java/org/bukkit/potion/PotionData.java +++ b/src/main/java/org/bukkit/potion/PotionData.java @@ -61,4 +61,25 @@ public final class PotionData { public boolean isExtended() { return extended; } + + @Override + public int hashCode() { + int hash = 7; + hash = 23 * hash + (this.type != null ? this.type.hashCode() : 0); + hash = 23 * hash + (this.extended ? 1 : 0); + hash = 23 * hash + (this.upgraded ? 1 : 0); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + PotionData other = (PotionData) obj; + return (this.upgraded == other.upgraded) && (this.extended == other.extended) && (this.type == other.type); + } } |