Skip to content

Commit ecc10d6

Browse files
committed
Update direct connection/compression disabler for newest BungeeCord
Fixes #5348
1 parent 3e61726 commit ecc10d6

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeCompressionDisabler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import io.netty.channel.ChannelHandlerContext;
2929
import io.netty.channel.ChannelOutboundHandlerAdapter;
3030
import io.netty.channel.ChannelPromise;
31+
import net.md_5.bungee.netty.LengthPrependerAndCompressor;
3132
import net.md_5.bungee.protocol.packet.LoginSuccess;
3233
import net.md_5.bungee.protocol.packet.SetCompression;
3334

@@ -40,8 +41,9 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
4041
// Fixes https://github.com/GeyserMC/Geyser/issues/4281
4142
// The server may send a LoginDisconnect packet after compression is set.
4243
if (!compressionDisabled) {
43-
if (ctx.pipeline().get("compress") != null) {
44-
ctx.pipeline().remove("compress");
44+
LengthPrependerAndCompressor compressor = ctx.pipeline().get(LengthPrependerAndCompressor.class);
45+
if (compressor.isCompress()) {
46+
compressor.setCompress(false);
4547
compressionDisabled = true;
4648
}
4749
if (ctx.pipeline().get("decompress") != null) {

bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeInjector.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ protected void initializeLocalChannel0(GeyserBootstrap bootstrap) throws Excepti
7373
throw new UnsupportedOperationException("Geyser does not currently support multiple listeners with injection! " +
7474
"Please reach out to us on our Discord at https://discord.gg/GeyserMC so we can hear feedback on your setup.");
7575
}
76+
77+
// TODO remove
78+
try {
79+
ProxyServer.class.getMethod("unsafe");
80+
} catch (NoSuchMethodException e) {
81+
throw new UnsupportedOperationException("You're using an outdated version of BungeeCord - please update. Thank you!");
82+
}
83+
7684
ListenerInfo listenerInfo = proxy.getConfig().getListeners().stream().findFirst().orElseThrow(IllegalStateException::new);
7785

7886
Class<? extends ProxyServer> proxyClass = proxy.getClass();
@@ -138,7 +146,7 @@ protected void initChannel(@NonNull Channel ch) throws Exception {
138146
if (channelInitializer == null) {
139147
// Proxy has finished initializing; we can safely grab this variable without fear of plugins modifying it
140148
// (Older versions of ViaVersion replace this to inject)
141-
channelInitializer = PipelineUtils.SERVER_CHILD;
149+
channelInitializer = proxy.unsafe().getFrontendChannelInitializer().getChannelInitializer();
142150
}
143151
initChannel.invoke(channelInitializer, ch);
144152

bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePingPassthrough.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,21 @@ public boolean isConnected() {
186186
return false;
187187
}
188188

189+
@Override
190+
public boolean isTransferred() {
191+
return false;
192+
}
193+
194+
@Override
195+
public CompletableFuture<byte[]> retrieveCookie(String s) {
196+
throw new UnsupportedOperationException();
197+
}
198+
199+
@Override
200+
public CompletableFuture<byte[]> sendData(String s, byte[] bytes) {
201+
throw new UnsupportedOperationException();
202+
}
203+
189204
@Override
190205
public Unsafe unsafe() {
191206
throw new UnsupportedOperationException();

0 commit comments

Comments
 (0)