13
0
geforkt von Mirrors/Velocity

Properly register client channels.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-11-10 23:20:33 -05:00
Ursprung 8a7ba25097
Commit c94794a845
2 geänderte Dateien mit 9 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -65,7 +65,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
@Override @Override
public void activated() { public void activated() {
PluginMessage register = PluginMessageUtil.constructChannelsPacket(player.getProtocolVersion(), PluginMessage register = PluginMessageUtil.constructChannelsPacket(player.getProtocolVersion(),
server.getChannelRegistrar().getModernChannelIds()); server.getChannelRegistrar().getChannelsForProtocol(player.getProtocolVersion()));
player.getConnection().write(register); player.getConnection().write(register);
} }

Datei anzeigen

@ -6,6 +6,7 @@ import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import com.velocitypowered.api.proxy.messages.ChannelRegistrar; import com.velocitypowered.api.proxy.messages.ChannelRegistrar;
import com.velocitypowered.api.proxy.messages.LegacyChannelIdentifier; import com.velocitypowered.api.proxy.messages.LegacyChannelIdentifier;
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier; import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
import com.velocitypowered.proxy.protocol.ProtocolConstants;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
@ -68,4 +69,11 @@ public class VelocityChannelRegistrar implements ChannelRegistrar {
public @Nullable ChannelIdentifier getFromId(String id) { public @Nullable ChannelIdentifier getFromId(String id) {
return identifierMap.get(id); return identifierMap.get(id);
} }
public Collection<String> getChannelsForProtocol(int protocolVersion) {
if (protocolVersion >= ProtocolConstants.MINECRAFT_1_13) {
return getModernChannelIds();
}
return getIdsForLegacyConnections();
}
} }