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

Commit

Permalink
Merge pull request #296 from dogboy21/patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
johnfriedrich authored Sep 15, 2021
2 parents 2026bb5 + b0dcde4 commit 81bbf85
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ private static class ProtocolData
private final int protocolVersion;
private final TObjectIntMap<Class<? extends DefinedPacket>> packetMap = new TObjectIntHashMap<>( MAX_PACKET_ID );
@SuppressWarnings("unchecked")
private final Supplier<? extends DefinedPacket>[] packetConstructors = new Supplier[ MAX_PACKET_ID ];
private final TIntObjectMap<Supplier<? extends DefinedPacket>> packetConstructors = new TIntObjectHashMap<>( MAX_PACKET_ID );
}

@Data
Expand Down Expand Up @@ -530,7 +530,7 @@ public final DefinedPacket createPacket(int id, int version)
throw new BadPacketException( "Packet with id " + id + " outside of range" );
}

Supplier<? extends DefinedPacket> constructor = protocolData.packetConstructors[id];
Supplier<? extends DefinedPacket> constructor = protocolData.packetConstructors.get( id );
return ( constructor == null ) ? null : constructor.get();
}

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

ProtocolData data = protocols.get( protocol );
data.packetMap.put( packetClass, mapping.packetID );
data.packetConstructors[mapping.packetID] = constructor;
data.packetConstructors.put( mapping.packetID, constructor );
}
}

Expand Down

0 comments on commit 81bbf85

Please sign in to comment.