From a849c38ce6c734facf18ffc7bc31a18315463f78 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Tue, 20 Nov 2012 06:59:56 +0100 Subject: [PATCH] Implement equals() and hashCode(), since we've implemented compareTo. --- .../comphenix/protocol/async/AsyncMarker.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncMarker.java b/ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncMarker.java index 694f55a8..b1a02e4d 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncMarker.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/async/AsyncMarker.java @@ -32,6 +32,7 @@ import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.injector.PrioritizedListener; import com.comphenix.protocol.reflect.FieldAccessException; import com.comphenix.protocol.reflect.FuzzyReflection; +import com.google.common.base.Objects; import com.google.common.primitives.Longs; /** @@ -447,4 +448,22 @@ public class AsyncMarker implements Serializable, Comparable { else return Longs.compare(getNewSendingIndex(), o.getNewSendingIndex()); } + + @Override + public boolean equals(Object other) { + // Standard equals + if (other == this) + return true; + if (other == null) + return false; + if (other instanceof AsyncMarker) + return Objects.equal(getNewSendingIndex(), ((AsyncMarker) other).getNewSendingIndex()); + + return false; + } + + @Override + public int hashCode() { + return Longs.hashCode(getNewSendingIndex()); + } }