Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
More BaseProtocol changes
Dieser Commit ist enthalten in:
Ursprung
f81892ea74
Commit
697e883649
@ -54,9 +54,15 @@ public class ProtocolPipeline extends Protocol {
|
|||||||
*/
|
*/
|
||||||
public void add(Protocol protocol) {
|
public void add(Protocol protocol) {
|
||||||
if (protocolList != null) {
|
if (protocolList != null) {
|
||||||
// Make BaseProtocol be in the last position, so the login packets can be modified by other protocols
|
protocolList.add(protocol);
|
||||||
protocolList.add(protocolList.size() - 1, protocol);
|
|
||||||
protocol.init(userConnection);
|
protocol.init(userConnection);
|
||||||
|
// Move base Protocols to the end, so the login packets can be modified by other protocols
|
||||||
|
List<Protocol> toMove = new ArrayList<>();
|
||||||
|
for (Protocol p : protocolList)
|
||||||
|
if (ProtocolRegistry.isBaseProtocol(p))
|
||||||
|
toMove.add(p);
|
||||||
|
protocolList.removeAll(toMove);
|
||||||
|
protocolList.addAll(toMove);
|
||||||
} else {
|
} else {
|
||||||
throw new NullPointerException("Tried to add protocol to early");
|
throw new NullPointerException("Tried to add protocol to early");
|
||||||
}
|
}
|
||||||
|
@ -230,4 +230,12 @@ public class ProtocolRegistry {
|
|||||||
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) {
|
||||||
|
for (Pair<Range<Integer>, Protocol> p : baseProtocols)
|
||||||
|
if (p.getValue() == protocol)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -131,8 +131,8 @@ public class BaseProtocol1_13 extends Protocol {
|
|||||||
Via.getManager().addPortedClient(wrapper.user());
|
Via.getManager().addPortedClient(wrapper.user());
|
||||||
|
|
||||||
if (info.getPipeline().pipes().size() == 2
|
if (info.getPipeline().pipes().size() == 2
|
||||||
&& info.getPipeline().pipes().get(0).getClass() == BaseProtocol1_13.class
|
&& info.getPipeline().pipes().get(1).getClass() == BaseProtocol1_13.class
|
||||||
&& info.getPipeline().pipes().get(1).getClass() == BaseProtocol.class) // Only base protocol
|
&& info.getPipeline().pipes().get(0).getClass() == BaseProtocol.class) // Only base protocol
|
||||||
wrapper.user().setActive(false);
|
wrapper.user().setActive(false);
|
||||||
|
|
||||||
if (Via.getManager().isDebug()) {
|
if (Via.getManager().isDebug()) {
|
||||||
|
@ -131,8 +131,8 @@ public class BaseProtocol1_7 extends Protocol {
|
|||||||
Via.getManager().addPortedClient(wrapper.user());
|
Via.getManager().addPortedClient(wrapper.user());
|
||||||
|
|
||||||
if (info.getPipeline().pipes().size() == 2
|
if (info.getPipeline().pipes().size() == 2
|
||||||
&& info.getPipeline().pipes().get(0).getClass() == BaseProtocol1_7.class
|
&& info.getPipeline().pipes().get(1).getClass() == BaseProtocol1_7.class
|
||||||
&& info.getPipeline().pipes().get(1).getClass() == BaseProtocol.class) // Only base protocol
|
&& info.getPipeline().pipes().get(0).getClass() == BaseProtocol.class) // Only base protocol
|
||||||
wrapper.user().setActive(false);
|
wrapper.user().setActive(false);
|
||||||
|
|
||||||
if (Via.getManager().isDebug()) {
|
if (Via.getManager().isDebug()) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren