node-minecraft-protocol: Java client throwing DecoderException on client.end

[✅ ] The FAQ doesn’t contain a resolution to my issue

Versions

minecraft-protocol: 1.41.0 server: vanilla node: 18.4.0

Detailed description of a problem

When calling client.end(...) on a connecting 1.19.2 client the connection is lost with the following message: Internal Exception: io.netty.handler.codec.DecoderException: aa: Non [a-z0-9_.-] character in namespace of location: {"text":"no server with subdomain localhost found"}

javaw_9kPvO8A7om

“no server with subdomain localhost found” is the message I intended to respond to the connecting client.

Current code

     const address = await getLocalAddress();
      const mcServer = mc.createServer({
        'online-mode': false,
        host: address,
        port: MC_SERVER_PORT,
        keepAlive: true,
      });

      mcServer.on('error', (e) => {
        this.logger.error('Error occurred while listening for logins', e);
      });
      mcServer.on(
        'login',
        async (client: ServerClient) => {
            // lines removed for brevity
            client.end("no server with subdomain localhost found");
        }
      );
      mcServer.on('listening', () => {
        this.logger.info(
          `Listening for login attempts on ${address}:${MC_SERVER_PORT}`,
        );
        resolve();
      }); 

Expected behavior

String passed into client.end(...) is what appears to the connecting Java client instead of the exception

Additional context

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

In my mind this is not something NMP should handle. Docs say otherwise, though. Gonna need an opinion from @rom1504