mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-12-19 14:59:27 +00:00
Update direct connection/compression disabler for newest BungeeCord
Fixes #5348
This commit is contained in:
@@ -28,6 +28,7 @@ package org.geysermc.geyser.platform.bungeecord;
|
|||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
|
import net.md_5.bungee.netty.LengthPrependerAndCompressor;
|
||||||
import net.md_5.bungee.protocol.packet.LoginSuccess;
|
import net.md_5.bungee.protocol.packet.LoginSuccess;
|
||||||
import net.md_5.bungee.protocol.packet.SetCompression;
|
import net.md_5.bungee.protocol.packet.SetCompression;
|
||||||
|
|
||||||
@@ -40,8 +41,9 @@ public class GeyserBungeeCompressionDisabler extends ChannelOutboundHandlerAdapt
|
|||||||
// Fixes https://github.com/GeyserMC/Geyser/issues/4281
|
// Fixes https://github.com/GeyserMC/Geyser/issues/4281
|
||||||
// The server may send a LoginDisconnect packet after compression is set.
|
// The server may send a LoginDisconnect packet after compression is set.
|
||||||
if (!compressionDisabled) {
|
if (!compressionDisabled) {
|
||||||
if (ctx.pipeline().get("compress") != null) {
|
LengthPrependerAndCompressor compressor = ctx.pipeline().get(LengthPrependerAndCompressor.class);
|
||||||
ctx.pipeline().remove("compress");
|
if (compressor.isCompress()) {
|
||||||
|
compressor.setCompress(false);
|
||||||
compressionDisabled = true;
|
compressionDisabled = true;
|
||||||
}
|
}
|
||||||
if (ctx.pipeline().get("decompress") != null) {
|
if (ctx.pipeline().get("decompress") != null) {
|
||||||
|
|||||||
@@ -73,6 +73,14 @@ public class GeyserBungeeInjector extends GeyserInjector implements Listener {
|
|||||||
throw new UnsupportedOperationException("Geyser does not currently support multiple listeners with injection! " +
|
throw new UnsupportedOperationException("Geyser does not currently support multiple listeners with injection! " +
|
||||||
"Please reach out to us on our Discord at https://discord.gg/GeyserMC so we can hear feedback on your setup.");
|
"Please reach out to us on our Discord at https://discord.gg/GeyserMC so we can hear feedback on your setup.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO remove
|
||||||
|
try {
|
||||||
|
ProxyServer.class.getMethod("unsafe");
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
throw new UnsupportedOperationException("You're using an outdated version of BungeeCord - please update. Thank you!");
|
||||||
|
}
|
||||||
|
|
||||||
ListenerInfo listenerInfo = proxy.getConfig().getListeners().stream().findFirst().orElseThrow(IllegalStateException::new);
|
ListenerInfo listenerInfo = proxy.getConfig().getListeners().stream().findFirst().orElseThrow(IllegalStateException::new);
|
||||||
|
|
||||||
Class<? extends ProxyServer> proxyClass = proxy.getClass();
|
Class<? extends ProxyServer> proxyClass = proxy.getClass();
|
||||||
@@ -138,7 +146,7 @@ public class GeyserBungeeInjector extends GeyserInjector implements Listener {
|
|||||||
if (channelInitializer == null) {
|
if (channelInitializer == null) {
|
||||||
// Proxy has finished initializing; we can safely grab this variable without fear of plugins modifying it
|
// Proxy has finished initializing; we can safely grab this variable without fear of plugins modifying it
|
||||||
// (Older versions of ViaVersion replace this to inject)
|
// (Older versions of ViaVersion replace this to inject)
|
||||||
channelInitializer = PipelineUtils.SERVER_CHILD;
|
channelInitializer = proxy.unsafe().getFrontendChannelInitializer().getChannelInitializer();
|
||||||
}
|
}
|
||||||
initChannel.invoke(channelInitializer, ch);
|
initChannel.invoke(channelInitializer, ch);
|
||||||
|
|
||||||
|
|||||||
@@ -186,6 +186,21 @@ public class GeyserBungeePingPassthrough implements IGeyserPingPassthrough, List
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTransferred() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<byte[]> retrieveCookie(String s) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<byte[]> sendData(String s, byte[] bytes) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Unsafe unsafe() {
|
public Unsafe unsafe() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
|||||||
Reference in New Issue
Block a user