3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

add exception for wrong protocol

Dieser Commit ist enthalten in:
creeper123123321 2019-11-24 09:04:37 -03:00
Ursprung b01fd89373
Commit a8a33a3a2b

Datei anzeigen

@ -18,10 +18,7 @@ import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.util.PipelineUtil; import us.myles.ViaVersion.util.PipelineUtil;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.*;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
public class PacketWrapper { public class PacketWrapper {
public static final int PASSTHROUGH_ID = 1000; public static final int PASSTHROUGH_ID = 1000;
@ -326,13 +323,14 @@ public class PacketWrapper {
// Other way if outgoing // Other way if outgoing
Collections.reverse(protocols); Collections.reverse(protocols);
} }
int index = 0; int index = -1;
for (int i = 0; i < protocols.size(); i++) { for (int i = 0; i < protocols.size(); i++) {
if (protocols.get(i).getClass().equals(packetProtocol)) { if (protocols.get(i).getClass().equals(packetProtocol)) {
index = skipCurrentPipeline ? (i + 1) : (i); index = skipCurrentPipeline ? (i + 1) : (i);
break; break;
} }
} }
if (index == -1) throw new NoSuchElementException(packetProtocol.getCanonicalName());
// Reset reader before we start // Reset reader before we start
resetReader(); resetReader();