Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Brackets.
Dieser Commit ist enthalten in:
Ursprung
697e883649
Commit
314af6d000
@ -58,9 +58,11 @@ public class ProtocolPipeline extends Protocol {
|
|||||||
protocol.init(userConnection);
|
protocol.init(userConnection);
|
||||||
// Move base Protocols to the end, so the login packets can be modified by other protocols
|
// Move base Protocols to the end, so the login packets can be modified by other protocols
|
||||||
List<Protocol> toMove = new ArrayList<>();
|
List<Protocol> toMove = new ArrayList<>();
|
||||||
for (Protocol p : protocolList)
|
for (Protocol p : protocolList) {
|
||||||
if (ProtocolRegistry.isBaseProtocol(p))
|
if (ProtocolRegistry.isBaseProtocol(p)) {
|
||||||
toMove.add(p);
|
toMove.add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
protocolList.removeAll(toMove);
|
protocolList.removeAll(toMove);
|
||||||
protocolList.addAll(toMove);
|
protocolList.addAll(toMove);
|
||||||
} else {
|
} else {
|
||||||
|
@ -225,16 +225,20 @@ public class ProtocolRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Protocol getBaseProtocol(int serverVersion) {
|
public static Protocol getBaseProtocol(int serverVersion) {
|
||||||
for (Pair<Range<Integer>, Protocol> rangeProtocol : Lists.reverse(baseProtocols))
|
for (Pair<Range<Integer>, Protocol> rangeProtocol : Lists.reverse(baseProtocols)) {
|
||||||
if (rangeProtocol.getKey().contains(serverVersion))
|
if (rangeProtocol.getKey().contains(serverVersion)) {
|
||||||
return rangeProtocol.getValue();
|
return rangeProtocol.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
throw new IllegalStateException("No Base Protocol for " + serverVersion);
|
throw new IllegalStateException("No Base Protocol for " + serverVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBaseProtocol(Protocol protocol) {
|
public static boolean isBaseProtocol(Protocol protocol) {
|
||||||
for (Pair<Range<Integer>, Protocol> p : baseProtocols)
|
for (Pair<Range<Integer>, Protocol> p : baseProtocols) {
|
||||||
if (p.getValue() == protocol)
|
if (p.getValue() == protocol) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren