Skip to content

Commit

Permalink
Improve compatibility with third party BungeeCord forks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Exceptionflug committed Feb 14, 2024
1 parent bd1e46f commit 9618235
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ public synchronized void registerMapping(Object mappable, ProtocolMapping mappin

@Override
public <T extends ProtocolMapping> T mapping(Object mappable, int protocolVersion) {
for (ProtocolMapping mapping : mappingMultimap.get(mappable)) {
if (mapping.inRange(protocolVersion)) {
return (T) mapping;
}
}
return null;
return (T) mappingMultimap.get(mappable).parallelStream()
.filter(protocolMapping -> protocolMapping.inRange(protocolVersion))
.findFirst().orElse(null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protoco
DebugUtil.writeDump(buf, new CorruptedFrameException("Protocolize is unable to read packet " + obtainProtocolizePacketClass().getName()
+ " at protocol version " + protocolVersion + " in direction " + direction.name()));
}
buf.resetReaderIndex();
} catch (Throwable throwable) {
BadPacketException badPacketException = new BadPacketException("Protocolize is unable to read packet " + obtainProtocolizePacketClass().getName()
+ " at protocol version " + protocolVersion + " in direction " + direction.name(), throwable);
Expand Down

0 comments on commit 9618235

Please sign in to comment.