diff --git a/index.d.ts b/index.d.ts index 6dc3932..5923920 100644 --- a/index.d.ts +++ b/index.d.ts @@ -189,6 +189,9 @@ declare module 'bedrock-protocol' { // Only allow one client to connect at a time (default: false) forceSinge?: boolean + // Do not disconnect clients on server packet parsing errors and drop the packet instead (default: false) + omitParseErrors?: boolean + // Dispatched when a new client has logged in, and we need authentication // tokens to join the backend server. Cached after the first login. // If this is not specified, the client will be disconnected with a login prompt. diff --git a/src/relay.js b/src/relay.js index c619949..8678457 100644 --- a/src/relay.js +++ b/src/relay.js @@ -49,7 +49,11 @@ class RelayPlayer extends Player { } catch (e) { this.server.deserializer.dumpFailedBuffer(packet, this.connection.address) console.error(this.connection.address, e) - this.disconnect('Server packet parse error') + + if (!this.options.omitParseErrors) { + this.disconnect('Server packet parse error') + } + return } const name = des.data.name