mirror of
https://github.com/PaperMC/Velocity.git
synced 2025-02-23 15:49:19 +08:00
Actually send plugin message registration to backend servers
I don't see where this was ever done, and don't see how plugin messaging could of ever worked, at least within the confines of CB and co, given the fact that we never seemed to be sending this to the backend?
This commit is contained in:
parent
768ecdb0c3
commit
550ca58a09
@ -18,6 +18,7 @@
|
||||
package com.velocitypowered.proxy.connection.backend;
|
||||
|
||||
import static com.velocitypowered.proxy.connection.backend.BungeeCordMessageResponder.getBungeeCordChannel;
|
||||
import static com.velocitypowered.proxy.protocol.util.PluginMessageUtil.constructChannelsPacket;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@ -61,6 +62,8 @@ import io.netty.buffer.ByteBufUtil;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.handler.timeout.ReadTimeoutException;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@ -105,12 +108,20 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
|
||||
public void activated() {
|
||||
serverConn.getServer().addPlayer(serverConn.getPlayer());
|
||||
|
||||
MinecraftConnection serverMc = serverConn.ensureConnected();
|
||||
if (server.getConfiguration().isBungeePluginChannelEnabled()) {
|
||||
MinecraftConnection serverMc = serverConn.ensureConnected();
|
||||
serverMc.write(PluginMessageUtil.constructChannelsPacket(serverMc.getProtocolVersion(),
|
||||
ImmutableList.of(getBungeeCordChannel(serverMc.getProtocolVersion()))
|
||||
));
|
||||
}
|
||||
|
||||
Collection<String> channels =
|
||||
server.getChannelRegistrar().getChannelsForProtocol(serverConn.getPlayer().getProtocolVersion());
|
||||
if (!channels.isEmpty()) {
|
||||
PluginMessage register = constructChannelsPacket(serverConn.getPlayer().getProtocolVersion(), channels);
|
||||
serverMc.write(register);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user