Skip to content

Commit 92d40ca

Browse files
authored
Fix skipping EaglerCraft players & error on join (#547)
* fix: fix skipping EaglerCraft players & error on join * docs: improve eagler comment
1 parent 0fd7f0c commit 92d40ca

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

common/src/main/java/xyz/jonesdev/sonar/common/InboundHandlerAdapter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ private static void rewriteProtocol(final @NotNull ChannelHandlerContext ctx,
193193
// Don't remove floodgate's pipelines
194194
|| entry.getKey().startsWith("geyser")
195195
|| entry.getKey().startsWith("floodgate")
196+
|| entry.getKey().startsWith("eagler")
196197
|| entry.getKey().equals("DefaultChannelPipeline$TailContext#0")) {
197198
continue;
198199
}

common/src/main/java/xyz/jonesdev/sonar/common/util/EaglerUtil.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424

2525
@UtilityClass
2626
public class EaglerUtil {
27-
// https://github.com/lax1dude/eaglerxserver/blob/main/core/src/main/java/net/lax1dude/eaglercraft/backend/server/adapter/PipelineAttributes.java
28-
public static final AttributeKey<Object> EAGLER_LISTENER_DATA = AttributeKey.valueOf("$eagler0");
29-
public static final AttributeKey<Object> EAGLER_PIPELINE_DATA = AttributeKey.valueOf("$eagler1");
27+
// Detect EaglerXServer WebSocket connections by checking for Eagler-specific pipeline handlers.
28+
private static final String H_EAGLER_HANDSHAKE = "eagler-handshake";
29+
private static final String H_EAGLER_FRAME_CODEC = "eagler-frame-codec";
3030

3131
public boolean isEaglerConnection(final @NotNull Channel channel) {
32-
return channel.attr(EAGLER_LISTENER_DATA).get() != null
33-
|| channel.attr(EAGLER_PIPELINE_DATA).get() != null;
32+
return channel.pipeline().get(H_EAGLER_HANDSHAKE) != null
33+
|| channel.pipeline().get(H_EAGLER_FRAME_CODEC) != null;
3434
}
3535
}

0 commit comments

Comments
 (0)