From 3257d6069aa4ecdf51341c62fa883234970ea7c6 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Sat, 22 Mar 2014 23:21:57 +0100 Subject: [PATCH] Compare packet type with equals(), just in case. --- .../main/java/com/comphenix/protocol/events/PacketEvent.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketEvent.java b/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketEvent.java index a7481b79..97bc9fb1 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketEvent.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketEvent.java @@ -29,6 +29,7 @@ import org.bukkit.event.Cancellable; import com.comphenix.protocol.Application; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.async.AsyncMarker; +import com.google.common.base.Objects; import com.google.common.base.Preconditions; public class PacketEvent extends EventObject implements Cancellable { @@ -169,7 +170,7 @@ public class PacketEvent extends EventObject implements Cancellable { throw new IllegalStateException("The packet event is read-only."); if (packet == null) throw new IllegalArgumentException("Cannot set packet to NULL. Use setCancelled() instead."); - if (this.packet != null && this.packet.getType() != packet.getType()) + if (this.packet != null && !Objects.equal(this.packet.getType(), packet.getType())) throw new IllegalArgumentException("Cannot change packet type from " + this.packet.getType() + " to " + packet.getType()); this.packet = packet; }