3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Respect server protocol version when writing packets to the server.

Needed for ViaVersion.
Dieser Commit ist enthalten in:
Andrew Steinborn 2018-10-23 13:06:54 -04:00
Ursprung 8a8199ca33
Commit fcef623847

Datei anzeigen

@ -135,7 +135,8 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
}
if (actuallyRegistered.size() > 0) {
PluginMessage newRegisterPacket = PluginMessageUtil.constructChannelsPacket(player.getProtocolVersion(), actuallyRegistered);
PluginMessage newRegisterPacket = PluginMessageUtil.constructChannelsPacket(player.getConnectedServer()
.getConnection().getProtocolVersion(), actuallyRegistered);
player.getConnectedServer().getConnection().write(newRegisterPacket);
}
} else if (PluginMessageUtil.isMCUnregister(packet)) {
@ -271,15 +272,16 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
serverBossBars.clear();
// Tell the server about this client's plugin message channels.
int serverVersion = player.getConnectedServer().getConnection().getProtocolVersion();
Collection<String> toRegister = new HashSet<>(clientPluginMsgChannels);
if (player.getProtocolVersion() >= ProtocolConstants.MINECRAFT_1_13) {
if (serverVersion >= ProtocolConstants.MINECRAFT_1_13) {
toRegister.addAll(server.getChannelRegistrar().getModernChannelIds());
} else {
toRegister.addAll(server.getChannelRegistrar().getIdsForLegacyConnections());
}
if (!toRegister.isEmpty()) {
player.getConnectedServer().getConnection().delayedWrite(PluginMessageUtil.constructChannelsPacket(
player.getConnection().getProtocolVersion(), toRegister));
serverVersion, toRegister));
}
// If we had plugin messages queued during login/FML handshake, send them now.