Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BjornTheProgrammer committed Sep 22, 2024
1 parent fb08567 commit 17fcefc
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.comphenix.protocol.injector.collection;

import java.util.Iterator;
import java.util.Set;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -45,7 +46,9 @@ public PacketListenerSet(PacketTypeListenerSet mainThreadPacketTypes, ErrorRepor
public void addListener(PacketListener packetListener) {
ListeningWhitelist listeningWhitelist = getListeningWhitelist(packetListener);

for (PacketType packetType : listeningWhitelist.getTypes()) {
for (Iterator<PacketType> packet = listeningWhitelist.getTypes().iterator(); packet.hasNext();) {
PacketType packetType = packet.next();

Set<PacketType> supportedPacketTypes = (packetType.getSender() == Sender.SERVER)
? PacketRegistry.getServerPacketTypes()
: PacketRegistry.getClientPacketTypes();
Expand All @@ -56,7 +59,7 @@ public void addListener(PacketListener packetListener) {
.build());

// remove unknown packet types
listeningWhitelist.getTypes().remove(packetType);
packet.remove();
}
}

Expand Down

0 comments on commit 17fcefc

Please sign in to comment.