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

Register 1.13+ channels on legacy clients too.

Prior to this commit, Velocity registered 1.13 and "legacy" channels
differently. This commit unifies both for legacy clients to make
compatibility easier. It also fixes a related issue in the new LuckPerms
port to Velocity.
Dieser Commit ist enthalten in:
Andrew Steinborn 2018-08-26 14:39:31 -04:00
Ursprung 2f6642dcd8
Commit 27288685ff
2 geänderte Dateien mit 5 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -45,7 +45,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
if (player.getProtocolVersion() >= ProtocolConstants.MINECRAFT_1_13) {
message = PluginMessageUtil.constructChannelsPacket("minecraft:register", VelocityServer.getServer().getChannelRegistrar().getModernChannelIds());
} else {
message = PluginMessageUtil.constructChannelsPacket("REGISTER", VelocityServer.getServer().getChannelRegistrar().getLegacyChannelIds());
message = PluginMessageUtil.constructChannelsPacket("REGISTER", VelocityServer.getServer().getChannelRegistrar().getIdsForLegacyConnections());
}
player.getConnection().write(message);
}
@ -188,7 +188,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
if (player.getProtocolVersion() >= ProtocolConstants.MINECRAFT_1_13) {
toRegister.addAll(VelocityServer.getServer().getChannelRegistrar().getModernChannelIds());
} else {
toRegister.addAll(VelocityServer.getServer().getChannelRegistrar().getLegacyChannelIds());
toRegister.addAll(VelocityServer.getServer().getChannelRegistrar().getIdsForLegacyConnections());
}
if (!toRegister.isEmpty()) {
String channel = player.getConnection().getProtocolVersion() >= ProtocolConstants.MINECRAFT_1_13 ?

Datei anzeigen

@ -1,6 +1,7 @@
package com.velocitypowered.proxy.messages;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.velocitypowered.api.proxy.messages.*;
import com.velocitypowered.proxy.protocol.packet.PluginMessage;
import org.apache.logging.log4j.LogManager;
@ -58,11 +59,8 @@ public class VelocityChannelRegistrar implements ChannelRegistrar {
}
}
public Collection<String> getLegacyChannelIds() {
return identifierMap.values().stream()
.filter(i -> i instanceof LegacyChannelIdentifier)
.map(ChannelIdentifier::getId)
.collect(Collectors.toList());
public Collection<String> getIdsForLegacyConnections() {
return ImmutableList.copyOf(identifierMap.keySet());
}
public Collection<String> getModernChannelIds() {