Chat Heads

Chat Heads

35M Downloads

Chat heads don't show up when player is using formatting for HaoNick

bendooms opened this issue · 9 comments

commented

Hello!

I'm using the plugin HaoNick for player aliasing on my server and a few of us are using the Chat Heads mod. But we're running into this issue where if we use any identifier in our nicknames, then our chat heads don't show.

For instance, if I wanted a red name, I would use the command /nick &4Ben (used this tool https://mctools.org/motd-creator). But since I included that &4 bit, my chat heads don't show up. If I just use /nick Ben, then it works fine.

I found a slight workaround where I just make fake ranks for each player, but I have a friend named "V" who we are trying to set his nickname as &lV to bypass the plugin's 3 character string restriction.

Is there a workaround to support the formatting? I tried using the mod's Name Alias section for my friend, but couldn't for the life of me get it working.

commented

Hm... formatting is actually supported since version 1 (0.1.0), so I'm not exactly sure what's happening here, so let's see...

In this part Chat Heads splits the whole chat message into "words", and it does skip over § formatting codes*.

In the next part it remaps words/nicknames into profile names before looking them up.
This should always work if set up correctly, have you tried entering just Ben -> actualname?

Leaving that question alone for a second, there's still the last part where it'll use getPlayerFromNickname() and I think I see an issue here. It'll get the nickname displayName.getString(), which can be formatted, and directly compares it to the unformatted name.

So that should be the cause, since you said /nick Ben does work (without name alias I assume).

Looks like I need to release another batch of versions, maybe even backports.
What Minecraft version are you playing on?

* Note: The & HaoNick uses is just for the command, since you cannot normally enter § in chat.

commented

Aight, new versions for 1.19 are up, let me know if there's still any issues (and if a backport is indeed required).

commented

Huh, that is unexpected!
I'm gonna try debug this on a local server.

commented

Wow, yeah.
So what's happening is: The plugin isn't setting a nickname, it's actually changing the player's profile name!*

> playerInfo.getProfile().getName(): §1Test

So the idea of it comparing an formatted name to an unformatted word was right, just at the wrong place.
I need to reimplement the vanilla connection.getPlayerInfo(word) to also strip out formatting.

* When you /nick you actually can see you hand bobbing back up, as if the player is loaded back in.

commented

Thanks for the quick response! Really like how active y'all are on here!

Unfortunately I still seem to be running into issues with the head :( Here's how my chat's looking now:
image

My user was just nicknamed with /nick Ben, and V's was nicknamed with /nick V&r. The colors are being set by the plugin's fake ranks.

If I try to add formatting to my nickname though, like /nick &lBen, then this happens:
image

Do I need to set anything in the mod configuration like the name alias section? Here's how I tried setting it up:
image

commented

Oh, and I'm on version 1.19.4 incase that makes a difference!

commented

Aight², this time for real!
New versions are up. Make sure to not use name aliases!

commented

Woo! It's working! Thank you so much!
image

Only difference I see now is that the chat heads are gone for the join messages:
image

But honestly, I'm not sure we need those anyway. I'm more than happy with this. Thanks again for the quick update and responses!

commented

Join messages aren't actually supposed to have chat heads, just like any other server message.
That is only a side effect of the "heuristic" sender detection (which is being used here since the server clearly isn't sending UUIDs).

The reason why it doesn't show the heads now is because HaoChat takes some time to send the new profile name to the client, but it'll use it for the join message immediately, so Chat Heads will compare "Ben" to your true profile name, which does not match.

Before that, you most likely had a name alias which it turned "Ben" or "V" into the true profile name, which did match, hence it got a chat head.
Using such a name alias now would break the name matching after receiving the new profile name though, so you gonna have to live without it.