Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Properly register client channels.
Dieser Commit ist enthalten in:
Ursprung
8a7ba25097
Commit
c94794a845
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren