geforkt von Mirrors/Velocity
Do not check if a plugin message channel is registered before forwarding it
This fixes issues with Servux and probably a crap ton of other bad mods. Purity on this front serves no real purpose than to say we're pedantic. A future commit may remove all tracking of registered channels altogether. There's strong evidence (back to Minecraft 1.8, at least) that we don't have to track this data and only need to send channels for plugin message channels registered by Velocity itself. This will likely involve more testing to see if this uncovers client bugs with older versions of the game.
Dieser Commit ist enthalten in:
Ursprung
445688b9a1
Commit
b0da4b60c7
@ -157,11 +157,6 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!serverConn.getPlayer().canForwardPluginMessage(serverConn.ensureConnected()
|
||||
.getProtocolVersion(), packet)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// We need to specially handle REGISTER and UNREGISTER packets. Later on, we'll write them to
|
||||
// the client.
|
||||
if (PluginMessageUtil.isRegister(packet)) {
|
||||
|
@ -168,11 +168,6 @@ public class TransitionSessionHandler implements MinecraftSessionHandler {
|
||||
|
||||
@Override
|
||||
public boolean handle(PluginMessage packet) {
|
||||
if (!serverConn.getPlayer().canForwardPluginMessage(serverConn.ensureConnected()
|
||||
.getProtocolVersion(), packet)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PluginMessageUtil.isRegister(packet)) {
|
||||
serverConn.getPlayer().getKnownChannels().addAll(PluginMessageUtil.getChannels(packet));
|
||||
} else if (PluginMessageUtil.isUnregister(packet)) {
|
||||
|
@ -52,7 +52,6 @@ import com.velocitypowered.proxy.config.VelocityConfiguration;
|
||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||
import com.velocitypowered.proxy.connection.MinecraftConnectionAssociation;
|
||||
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
|
||||
import com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants;
|
||||
import com.velocitypowered.proxy.connection.player.VelocityResourcePackInfo;
|
||||
import com.velocitypowered.proxy.connection.util.ConnectionMessages;
|
||||
import com.velocitypowered.proxy.connection.util.ConnectionRequestResults.Impl;
|
||||
@ -66,7 +65,6 @@ import com.velocitypowered.proxy.protocol.packet.KeepAlive;
|
||||
import com.velocitypowered.proxy.protocol.packet.PluginMessage;
|
||||
import com.velocitypowered.proxy.protocol.packet.ResourcePackRequest;
|
||||
import com.velocitypowered.proxy.protocol.packet.title.GenericTitlePacket;
|
||||
import com.velocitypowered.proxy.protocol.util.PluginMessageUtil;
|
||||
import com.velocitypowered.proxy.server.VelocityRegisteredServer;
|
||||
import com.velocitypowered.proxy.tablist.VelocityTabList;
|
||||
import com.velocitypowered.proxy.tablist.VelocityTabListLegacy;
|
||||
@ -928,31 +926,6 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
return knownChannels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether or not we can forward a plugin message onto the client.
|
||||
* @param version the Minecraft protocol version
|
||||
* @param message the plugin message to forward to the client
|
||||
* @return {@code true} if the message can be forwarded, {@code false} otherwise
|
||||
*/
|
||||
public boolean canForwardPluginMessage(ProtocolVersion version, PluginMessage message) {
|
||||
boolean minecraftOrFmlMessage;
|
||||
|
||||
// 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.startsWith(LegacyForgeConstants.FORGE_LEGACY_HANDSHAKE_CHANNEL)
|
||||
|| PluginMessageUtil.isLegacyRegister(message)
|
||||
|| PluginMessageUtil.isLegacyUnregister(message);
|
||||
} 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());
|
||||
}
|
||||
|
||||
private class IdentityImpl implements Identity {
|
||||
@Override
|
||||
public @NonNull UUID uuid() {
|
||||
|
@ -79,27 +79,6 @@ public final class PluginMessageUtil {
|
||||
.equals(UNREGISTER_CHANNEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether or not this plugin message is a legacy (<1.13) registration plugin message.
|
||||
* @param message the plugin message
|
||||
* @return whether this is a legacy register message
|
||||
*/
|
||||
public static boolean isLegacyRegister(PluginMessage message) {
|
||||
checkNotNull(message, "message");
|
||||
return message.getChannel().equals(REGISTER_CHANNEL_LEGACY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether or not this plugin message is a legacy (<1.13) unregistration plugin
|
||||
* message.
|
||||
* @param message the plugin message
|
||||
* @return whether this is a legacy unregister message
|
||||
*/
|
||||
public static boolean isLegacyUnregister(PluginMessage message) {
|
||||
checkNotNull(message, "message");
|
||||
return message.getChannel().equals(UNREGISTER_CHANNEL_LEGACY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches all the channels in a register or unregister plugin message.
|
||||
* @param message the message to get the channels from
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren