mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-04 12:51:09 -05:00
Small optimization to PacketProtocol.getOutgoingId(Class<? extends Packet>)
This commit is contained in:
parent
27cdf88b36
commit
74ee4fa02b
1 changed files with 3 additions and 2 deletions
|
@ -137,11 +137,12 @@ public abstract class PacketProtocol {
|
|||
* @throws IllegalArgumentException If the packet is not registered.
|
||||
*/
|
||||
public final int getOutgoingId(Class<? extends Packet> 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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue