Skip to content
This repository was archived by the owner on Jul 15, 2022. It is now read-only.

Commit 81bbf85

Browse files
Merge pull request #296 from dogboy21/patch-3
2 parents 2026bb5 + b0dcde4 commit 81bbf85

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ private static class ProtocolData
471471
private final int protocolVersion;
472472
private final TObjectIntMap<Class<? extends DefinedPacket>> packetMap = new TObjectIntHashMap<>( MAX_PACKET_ID );
473473
@SuppressWarnings("unchecked")
474-
private final Supplier<? extends DefinedPacket>[] packetConstructors = new Supplier[ MAX_PACKET_ID ];
474+
private final TIntObjectMap<Supplier<? extends DefinedPacket>> packetConstructors = new TIntObjectHashMap<>( MAX_PACKET_ID );
475475
}
476476

477477
@Data
@@ -530,7 +530,7 @@ public final DefinedPacket createPacket(int id, int version)
530530
throw new BadPacketException( "Packet with id " + id + " outside of range" );
531531
}
532532

533-
Supplier<? extends DefinedPacket> constructor = protocolData.packetConstructors[id];
533+
Supplier<? extends DefinedPacket> constructor = protocolData.packetConstructors.get( id );
534534
return ( constructor == null ) ? null : constructor.get();
535535
}
536536

@@ -561,7 +561,7 @@ private void registerPacket(Class<? extends DefinedPacket> packetClass, Supplier
561561

562562
ProtocolData data = protocols.get( protocol );
563563
data.packetMap.put( packetClass, mapping.packetID );
564-
data.packetConstructors[mapping.packetID] = constructor;
564+
data.packetConstructors.put( mapping.packetID, constructor );
565565
}
566566
}
567567

0 commit comments

Comments
 (0)