mirror of
https://github.com/tribufu/node-gamedig
synced 2026-06-01 09:42:41 +00:00
fix: minecraft vanilla top level description text and mixed cases (#599)
* fix: minecraft vanilla top level description text * i have minecraft description strings this should be tested.... * feat: better minecraft name composure
This commit is contained in:
parent
53eace3cf8
commit
b6ac839162
2 changed files with 13 additions and 13 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -1,12 +1,14 @@
|
||||||
|
|
||||||
## To Be Released...
|
## To Be Released...
|
||||||
## 5.X.Y
|
## 5.X.Y
|
||||||
* Fix branding for alt:V Multiplayer (By @xCausxn #600)
|
|
||||||
* 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)
|
|
||||||
* Lock dependencies to fix problems with cheerio's `1.0.0` release and update punycode to `2.3.1` to mitigate
|
* Lock dependencies to fix problems with cheerio's `1.0.0` release and update punycode to `2.3.1` to mitigate
|
||||||
a vulnerability (#604)
|
a vulnerability (#604)
|
||||||
|
* Fix the `name` field on Minecraft servers:
|
||||||
|
* * running Velocity with multiple layers of color encoding (#595)
|
||||||
|
* * the top-level text of the description is a string composed of empty characters (#599)
|
||||||
|
* Fix branding for alt:V Multiplayer (By @xCausxn #600)
|
||||||
|
* 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)
|
||||||
|
|
|
||||||
|
|
@ -60,22 +60,20 @@ export default class minecraft extends Core {
|
||||||
const description = vanillaState.raw.description
|
const description = vanillaState.raw.description
|
||||||
if (typeof description === 'string') {
|
if (typeof description === 'string') {
|
||||||
name = description
|
name = description
|
||||||
}
|
} else if (typeof description === 'object') {
|
||||||
if (!name && typeof description === 'object' && description.text) {
|
name = description?.text || ''
|
||||||
name = description.text
|
|
||||||
}
|
const stack = [description]
|
||||||
if (!name && typeof description === 'object' && description.extra) {
|
|
||||||
let stack = [description];
|
|
||||||
|
|
||||||
while (stack.length) {
|
while (stack.length) {
|
||||||
let current = stack.pop();
|
const current = stack.pop()
|
||||||
|
|
||||||
if (current.text) {
|
if (current.text) {
|
||||||
name += current.text;
|
name += current.text
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(current.extra)) {
|
if (Array.isArray(current.extra)) {
|
||||||
stack.push(...current.extra.reverse());
|
stack.push(...current.extra.reverse())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue