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