3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Try to unbreak ViaVersion a little bit.

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-05-15 15:52:07 -04:00
Ursprung 742865bf0a
Commit d805f79d9b
2 geänderte Dateien mit 25 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -658,17 +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)) {
return true;
}
// By default, all internal Minecraft and Forge channels are forwarded from the server. // 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|")
.startsWith(LegacyForgeConstants.FORGE_LEGACY_HANDSHAKE_CHANNEL); || channel.startsWith(LegacyForgeConstants.FORGE_LEGACY_HANDSHAKE_CHANNEL)
|| PluginMessageUtil.isLegacyRegister(message)
|| PluginMessageUtil.isLegacyUnregister(message);
} else { } else {
minecraftOrFmlMessage = message.getChannel().startsWith("minecraft:"); minecraftOrFmlMessage = message.getChannel().startsWith("minecraft:");
} }

Datei anzeigen

@ -61,6 +61,27 @@ public class PluginMessageUtil {
.equals(UNREGISTER_CHANNEL); .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. * Fetches all the channels in a register or unregister plugin message.
* @param message the message to get the channels from * @param message the message to get the channels from