Skip to content

Compatibility with FFAPI and Velocity #4228

@Sam-Chai

Description

@Sam-Chai

Affected Product(s)

SpongeNeo

Version

spongeneo-1.21.1-21.1.35-12.0.2-universal

Operating System

Windows for server, macOS for client

Java Version

java 21

Plugins/Mods

- Forgified Fabric API(FFAPI)
- Sponge
- Velocity (Proxy)
- *NeoVelocity*

Describe the bug

Here is the bug:
If I installed the FFAPI and Sponge, then cannot setup the proxy setup. The client shows "Unexpected custom data from client" (In some cases shows "Timed out")

In other issues (from connector, the FFAPI and the NeoVelocity) they telled me it seems like the FFAPI send a custom packets but the Neo (ofcourse in my case is Sponge) cannot understand these packets, and fire the vanilla handleCustomQueryPacket method on ServerLoginPacketListenerImpl class. Then kicked out.

Here is the issue links:

I found that the NeoVelocity already fixed this bug:
Gabwasnt/NeoVelocity#13

Of course I can't install NeoVelocity on the Sponge because the Sponge handled the networking for the proxy.

The Sponge code:https://github.com/SpongePowered/Sponge/blob/b3a10010172ad764178134c4146b89026c5632ab/src/mixins/java/org/spongepowered/common/mixin/core/server/network/ServerLoginPacketListenerImplMixin.java#L290C23-L290C46

@Inject(method = "handleCustomQueryPacket", at = @At("HEAD"), cancellable = true)
    private void impl$onHandleCustomQueryPacket(final ServerboundCustomQueryAnswerPacket packet, final CallbackInfo ci) {
        final CustomQueryAnswerPayload payload = packet.payload();
        final int transactionId = packet.transactionId();
        if (!(payload instanceof SpongeChannelPayload
            // some clients may answer a null payload to unknown queries
            || (payload == null && ((ConnectionBridge) this.connection).bridge$getTransactionStore().contains(transactionId)))) {
            return;
        }

        ci.cancel();

        this.server.execute(() -> {
            final SpongeChannelManager channelRegistry = (SpongeChannelManager) Sponge.channelManager();
            final EngineConnection connection = ((ConnectionBridge) this.connection).bridge$getEngineConnection();
            channelRegistry.handleLoginResponsePayload(connection, (EngineConnectionState) this, transactionId, payload == null ? null : ((SpongeChannelPayload) payload).consumer());
        });
    }

Is there any possible to fix that out? I think to add the NeoVelocity's fix is enough.

Thanks!!!

Link to logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageThis label is automatically applied to new issues and pull requests to indicate they require triagetype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions