From 46b34edb29d2c884220ec3fa62f7f33f654eadf0 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sat, 12 Mar 2016 13:08:44 +1100 Subject: [PATCH] Add equals / hashCode for PotionData By: md_5 --- .../java/org/bukkit/potion/PotionData.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/potion/PotionData.java b/paper-api/src/main/java/org/bukkit/potion/PotionData.java index 7e9ce38a9b..6e8139a9ed 100644 --- a/paper-api/src/main/java/org/bukkit/potion/PotionData.java +++ b/paper-api/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); + } }