diff --git a/src/main/java/com/github/steveice10/packetlib/packet/PacketProtocol.java b/src/main/java/com/github/steveice10/packetlib/packet/PacketProtocol.java index 7d5464a4..15b6586d 100644 --- a/src/main/java/com/github/steveice10/packetlib/packet/PacketProtocol.java +++ b/src/main/java/com/github/steveice10/packetlib/packet/PacketProtocol.java @@ -137,11 +137,12 @@ public abstract class PacketProtocol { * @throws IllegalArgumentException If the packet is not registered. */ public final int getOutgoingId(Class packetClass) { - if(!this.outgoing.containsKey(packetClass) || this.outgoing.get(packetClass) == null) { + Integer packetId = this.outgoing.get(packetClass); + if(packetId == null) { throw new IllegalArgumentException("Unregistered outgoing packet class: " + packetClass.getName()); } - return this.outgoing.get(packetClass); + return packetId; } /**