13
0
geforkt von Mirrors/Velocity

Better document what plugin channels we need to forward onto clients.

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-05-12 11:09:50 -04:00
Ursprung 3c9cc2c4a8
Commit 57085feb42

Datei anzeigen

@ -658,10 +658,13 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
public boolean canForwardPluginMessage(ProtocolVersion version, PluginMessage message) { public boolean canForwardPluginMessage(ProtocolVersion version, PluginMessage message) {
boolean minecraftOrFmlMessage; 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)) { if (PluginMessageUtil.isRegister(message) || PluginMessageUtil.isUnregister(message)) {
return true; return true;
} }
// By default, all internal Minecraft and Forge channels are forwarded from the server.
if (version.compareTo(ProtocolVersion.MINECRAFT_1_12_2) <= 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_12_2) <= 0) {
String channel = message.getChannel(); String channel = message.getChannel();
minecraftOrFmlMessage = channel.startsWith("MC|") || channel minecraftOrFmlMessage = channel.startsWith("MC|") || channel
@ -669,6 +672,9 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
} else { } else {
minecraftOrFmlMessage = message.getChannel().startsWith("minecraft:"); 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()) return minecraftOrFmlMessage || knownChannels.contains(message.getChannel())
|| server.getChannelRegistrar().registered(message.getChannel()); || server.getChannelRegistrar().registered(message.getChannel());
} }