diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java index 4ca4f9c39c..801a3db619 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java @@ -345,7 +345,7 @@ private static class ProtocolData private final int protocolVersion; private final TObjectIntMap> packetMap = new TObjectIntHashMap<>( MAX_PACKET_ID ); - private final Constructor[] packetConstructors = new Constructor[ MAX_PACKET_ID ]; + private final TIntObjectMap> packetConstructors = new TIntObjectHashMap<>( MAX_PACKET_ID ); } @Data @@ -404,7 +404,7 @@ public final DefinedPacket createPacket(int id, int version) throw new BadPacketException( "Packet with id " + id + " outside of range " ); } - Constructor constructor = protocolData.packetConstructors[id]; + Constructor constructor = protocolData.packetConstructors.get( id ); try { return ( constructor == null ) ? null : constructor.newInstance(); @@ -445,7 +445,7 @@ private void registerPacket(Class packetClass, Protocol ProtocolData data = protocols.get( protocol ); data.packetMap.put( packetClass, mapping.packetID ); - data.packetConstructors[mapping.packetID] = constructor; + data.packetConstructors.put( mapping.packetID, constructor ); } } catch ( NoSuchMethodException ex ) {