Don’t use the Sone’s ID but (maybe) also the Sone’s shell’s ID.
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Sone.java
index 7041289..6d729c3 100644 (file)
@@ -197,7 +197,7 @@ public class Sone {
         * @return This Sone (for method chaining)
         */
        public synchronized Sone addFriend(Sone friendSone) {
-               if (friendSones.add(friendSone)) {
+               if (!friendSone.equals(this) && friendSones.add(friendSone)) {
                        modificationCounter++;
                }
                return this;
@@ -336,7 +336,7 @@ public class Sone {
         */
        @Override
        public int hashCode() {
-               return id.hashCode();
+               return getId().hashCode();
        }
 
        /**
@@ -347,7 +347,7 @@ public class Sone {
                if (!(object instanceof Sone)) {
                        return false;
                }
-               return ((Sone) object).id.equals(id);
+               return ((Sone) object).id.equals(getId());
        }
 
        /**