3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00

Port all the clients to prevent issues like ViaVersions BossBarAPI not working for clients on the same protocol. (If you use the api on a 1.9> server)

Dieser Commit ist enthalten in:
Matsv 2016-06-29 11:35:15 +02:00
Ursprung 85e416171c
Commit 805c78989a

Datei anzeigen

@ -31,6 +31,8 @@ public class BaseProtocol extends Protocol {
@Override @Override
protected void registerPackets() { protected void registerPackets() {
/* Outgoing Packets */ /* Outgoing Packets */
// Status Response Packet
registerOutgoing(State.STATUS, 0x00, 0x00, new PacketRemapper() { // Status Response Packet registerOutgoing(State.STATUS, 0x00, 0x00, new PacketRemapper() { // Status Response Packet
@Override @Override
public void registerMap() { public void registerMap() {
@ -51,7 +53,7 @@ public class BaseProtocol extends Protocol {
} }
List<Pair<Integer, Protocol>> protocols = ProtocolRegistry.getProtocolPath(info.getProtocolVersion(), ProtocolRegistry.SERVER_PROTOCOL); List<Pair<Integer, Protocol>> protocols = ProtocolRegistry.getProtocolPath(info.getProtocolVersion(), ProtocolRegistry.SERVER_PROTOCOL);
if (protocols != null) { if (protocols != null) {
if ((long) version.get("protocol") != 9999) //Fix serverlistplus if ((long) version.get("protocol") != 9999) //Fix ServerListPlus
version.put("protocol", info.getProtocolVersion()); version.put("protocol", info.getProtocolVersion());
} else { } else {
// not compatible :(, *plays very sad violin* // not compatible :(, *plays very sad violin*
@ -88,6 +90,10 @@ public class BaseProtocol extends Protocol {
info.setUsername(wrapper.get(Type.STRING, 1)); info.setUsername(wrapper.get(Type.STRING, 1));
// Add to ported clients // Add to ported clients
((ViaVersionPlugin) ViaVersion.getInstance()).addPortedClient(wrapper.user()); ((ViaVersionPlugin) ViaVersion.getInstance()).addPortedClient(wrapper.user());
if (info.getPipeline().pipes().size() == 1 && info.getPipeline().pipes().get(0).getClass() == BaseProtocol.class) // Only base protocol
wrapper.user().setActive(false);
if (ViaVersion.getInstance().isDebug()) { if (ViaVersion.getInstance().isDebug()) {
// Print out the route to console // Print out the route to console
((ViaVersionPlugin) ViaVersion.getInstance()).getLogger().log(Level.INFO, "{0} logged in with protocol {1}, Route: {2}", ((ViaVersionPlugin) ViaVersion.getInstance()).getLogger().log(Level.INFO, "{0} logged in with protocol {1}, Route: {2}",
@ -130,11 +136,6 @@ public class BaseProtocol extends Protocol {
pipeline.add(prot.getValue()); pipeline.add(prot.getValue());
} }
wrapper.set(Type.VAR_INT, 0, ProtocolRegistry.SERVER_PROTOCOL); wrapper.set(Type.VAR_INT, 0, ProtocolRegistry.SERVER_PROTOCOL);
} else {
if (state == 2) {
// not compatible :(, *plays very sad violin*
wrapper.user().setActive(false);
}
} }
// Change state // Change state