mirror of
https://github.com/tribufu/node-gamedig
synced 2026-06-01 09:42:41 +00:00
feat: add a rules bytes return for valve protocol (#597)
* feat: added a rules bytes return for valve protocol * chore: add changelog
This commit is contained in:
parent
1c7c1e66f4
commit
9e83681cee
2 changed files with 5 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
## 5.X.Y
|
## 5.X.Y
|
||||||
* Fix the `name` field on Minecraft servers running Velocity with multiple layers of color encoding (#595)
|
* 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 [Bun](https://bun.sh/) runtime support (#596)
|
||||||
|
* Added a rules bytes return for valve protocol (By @blackwaterbread #597)
|
||||||
|
|
||||||
## 5.1.0
|
## 5.1.0
|
||||||
* FOUNDRY - Added support (#585)
|
* FOUNDRY - Added support (#585)
|
||||||
|
|
|
||||||
|
|
@ -210,12 +210,15 @@ export default class valve extends Core {
|
||||||
|
|
||||||
const rules = {}
|
const rules = {}
|
||||||
state.raw.rules = rules
|
state.raw.rules = rules
|
||||||
|
state.raw.rulesBytes = Buffer.from([])
|
||||||
|
|
||||||
this.logger.debug('Requesting rules ...')
|
this.logger.debug('Requesting rules ...')
|
||||||
|
|
||||||
if (this.goldsrcInfo) {
|
if (this.goldsrcInfo) {
|
||||||
const b = await this.udpSend('\xff\xff\xff\xffrules', b => b, () => null)
|
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
|
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 reader = this.reader(b)
|
||||||
while (!reader.done()) {
|
while (!reader.done()) {
|
||||||
const key = reader.string()
|
const key = reader.string()
|
||||||
|
|
@ -225,6 +228,7 @@ export default class valve extends Core {
|
||||||
const b = await this.sendPacket(0x56, null, 0x45, true)
|
const b = await this.sendPacket(0x56, null, 0x45, true)
|
||||||
if (b === null && !this.options.requestRulesRequired) return // timed out - the server probably has rules disabled
|
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 reader = this.reader(b)
|
||||||
const num = reader.uint(2)
|
const num = reader.uint(2)
|
||||||
for (let i = 0; i < num; i++) {
|
for (let i = 0; i < num; i++) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue