From 9e83681cee827b3030364896455a960d80f3e8a7 Mon Sep 17 00:00:00 2001 From: dayrain Date: Mon, 5 Aug 2024 19:16:45 +0900 Subject: [PATCH] feat: add a rules bytes return for valve protocol (#597) * feat: added a rules bytes return for valve protocol * chore: add changelog --- CHANGELOG.md | 1 + protocols/valve.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a9a824..0da13f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 5.X.Y * Fix the `name` field on Minecraft servers running Velocity with multiple layers of color encoding (#595) * Added [Bun](https://bun.sh/) runtime support (#596) +* Added a rules bytes return for valve protocol (By @blackwaterbread #597) ## 5.1.0 * FOUNDRY - Added support (#585) diff --git a/protocols/valve.js b/protocols/valve.js index 8c1c5a8..2a25082 100644 --- a/protocols/valve.js +++ b/protocols/valve.js @@ -210,12 +210,15 @@ export default class valve extends Core { const rules = {} state.raw.rules = rules + state.raw.rulesBytes = Buffer.from([]) this.logger.debug('Requesting rules ...') if (this.goldsrcInfo) { const b = await this.udpSend('\xff\xff\xff\xffrules', b => b, () => null) if (b === null && !this.options.requestRulesRequired) return // timed out - the server probably has rules disabled + + state.raw.rulesBytes = b const reader = this.reader(b) while (!reader.done()) { const key = reader.string() @@ -225,6 +228,7 @@ export default class valve extends Core { const b = await this.sendPacket(0x56, null, 0x45, true) if (b === null && !this.options.requestRulesRequired) return // timed out - the server probably has rules disabled + state.raw.rulesBytes = b const reader = this.reader(b) const num = reader.uint(2) for (let i = 0; i < num; i++) {