From 57085feb42797351df1bb50ddc5327e7fbef99a6 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 12 May 2019 11:09:50 -0400 Subject: [PATCH] Better document what plugin channels we need to forward onto clients. --- .../proxy/connection/client/ConnectedPlayer.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index f6f104bc3..9e950e201 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -658,10 +658,13 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { public boolean canForwardPluginMessage(ProtocolVersion version, PluginMessage message) { boolean minecraftOrFmlMessage; + // We should _always_ pass on new channels the server wishes to register (or unregister) with + // us. if (PluginMessageUtil.isRegister(message) || PluginMessageUtil.isUnregister(message)) { return true; } + // By default, all internal Minecraft and Forge channels are forwarded from the server. if (version.compareTo(ProtocolVersion.MINECRAFT_1_12_2) <= 0) { String channel = message.getChannel(); minecraftOrFmlMessage = channel.startsWith("MC|") || channel @@ -669,6 +672,9 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { } else { minecraftOrFmlMessage = message.getChannel().startsWith("minecraft:"); } + + // Otherwise, we need to see if the player already knows this channel or it's known by the + // proxy. return minecraftOrFmlMessage || knownChannels.contains(message.getChannel()) || server.getChannelRegistrar().registered(message.getChannel()); }