PassTheMayo / minecraft-server-util

A Node.js library for Minecraft servers that can retrieve status, query, RCON, and send Votifier votes.
https://passthemayo.gitbook.io/minecraft-server-util/
MIT License
141 stars 24 forks source link

bug: Wrong motd! #60

Closed PetyXbron closed 2 years ago

PetyXbron commented 2 years ago

Getting wrong motd from new package version

I was using an old version of minecraft-server-util. It was version 3.7.2. Getting motd was easy. I found on internet some javascript code to decode Minecraft colors characters (& or §). Decoding code looks like this:

const 
motd1 = response.description.descriptionText,
motd2 = motd1.toString().replace(/\u00A7[0-9A-FK-OR]/ig, '');

Result looked like this (3.7.2): image btw this is the right response as Minecraft server list shows. image

But the problem is, that I updated to the newest version (5.1.2 for me) And the motd is not right. Even the new "raw" and "clean" version.

This is the new (wrong) result (5.1.2): image Let me show you what's missing. image

As marked, there is missing letter O in the word SuroCraft, letter T in word SuroCraft, the arrow that points to left on end of the motd(◄), these characters (⋘⋇⋙) at the end and start of the motd line 2.

Help: If you would need, I am pasting here the real motd line 1 code with color codes; &l&6&m► &r&b&l Suro&c&lCraft&a.eu &6&l&m ◄&r (There are some useless color code symbols lol.)

I am pasting here raw and clean results from status function (just first line): ' ► SurCraf.eu (clean) §f' §6§m►§b§l Sur§c§lCraf§a.eu§6§l§m §f (raw)

By the way, if you wonder, there's an apostrophe at the start of motd lines. Why? Because we tried to center our motds by this way.

Note: I tried to use mentioned decoding code for minecraft color codes for the new one version. Because (I think so) the raw of motd is broken too, decoding code is giving me the same answer as clean version. Maybe you use the same decoding code?

Expected behavior: Motd should be right as older version 3.7.2. What changed?

PassTheMayo commented 2 years ago

@PetyXbron This was actually fixed in minecraft-motd-util version 1.1.6. You can update that library (which is a dependency of this one) by doing npm update minecraft-motd-util.

PetyXbron commented 2 years ago

Yes. Fixed. Thanks!