mc-utils
mc-utils copied to clipboard
[Util Change]: Server Info bugs
Util Name
Server Info
Changes
Fix the font, fix the undefined
Extra Info
No errors in console
There seems to be a conflict between the latin letter small capital unicode character and the font being applied. The minecraft monospace font doesn't seem to have a "F" variant, when changed to the minecraft font it shows as "normal". The undefined is coming from the fact that the code does not check if item from the json request is an object so when item is a string, which is the case for the motd from flyte.gg
motd_json": {
"extra": [
{
"color": "light_purple",
"text": " ꜰʟʏᴛᴇ ѕᴍᴘ"
},
"\n"
],
so "\n" will be shown as undefined. This can be changed by changing:
let asString = status.motd_json.extra.reduce((acc, item) => {
if (item.color) {
return acc + `%${item.color}%${item.text}`;
}
return acc + item.text;
}, '');
is changed into:
let asString = status.motd_json.extra.reduce((acc, item) => {
if (typeof item === 'object' && item.color) {
return acc + `%${item.color}%${item.text}`;
}
return acc + (typeof item === 'object' ? item.text : item);
}, '');
How the font/unicode stuff needs to be changed is above my head.
Edit: forgot text
This was closed by #212