[Minecraft] Duplication of names in Minecraft
Operating System
Debian 12
AMP Version and Build Date
2.6.0.10 - 30/01/2025
AMP Release Stream
Mainline
I confirm that
- [x] I have searched for an existing bug report for this issue.
- [x] I am using the latest available version of AMP.
- [x] my operating system is up-to-date.
Intended Action
Minecraft users are not duplicated.
Expected Behaviour
Minecraft usernames in analytics/online users are unique and should only include their actual minecraft username.
Actual Behaviour
Minecraft user's are duplicated in Analytics and online when using any type of nickname/name modifier such as ranks.
We can see that the user christrot here is being counted as his 'normal' username, as well as every rank they've ever been.
Reproduction
Spin up minecraft and use any type of nickname/name modifier such as FTBRanks, etc.
Can you share the log lines where the user joined and it was duplicated?
Suggestion:
All minecraft servers should have a 'usernamecache.json' that has the format:
{
"211435b0-xxxx-xxxx-xxxx-e463f7eb64b5": "Mx772",
"b982df91-xxxx-xxxx-xxxx-33e8c71f4aa8": "christrot",
}
From this discord message: https://discord.com/channels/266012086423912458/1334927858258411662/1334947803717177428
It's noted that the time starts from when a user joins. If we build upon that logic, we can use this to get their UUID, which will not change:
Sending Player Data to player literal{christrot} with UUID b982df91-xxxx-xxxx-xxxx-33e8c71f4aa8.
This will also use their minecraft username which is also unique. Either of these should be set as the source of truth, and build the analytics, online users list off of these.
Additionally, as suggested in the thread, adding a space between the rank and username just results in christrot: with an extra : at the end which is used so ingame there is some separation. Removing the : does workaround it though...
Can you share the log lines where the user joined and it was duplicated?
Guessing it's this line here:
christrot[IPADDR]: logged in with entity id 1379 at (242.43342283359968, 84.875, -4762.803403989056)
christrot: joined the game <----
Note: This is after adding the space, but still having the : character.
Right click the instance and View Logs and get the log file from there and share it here.
Right click the instance and View Logs and get the log file from there and share it here.
[03:43:31] [User Authenticator #23/INFO]: UUID of player christrot is b982df91-xxxx-xxxx-xxxx-33e8c71f4aa8
[03:43:37] [Server thread/INFO]: christrot[/IP]: logged in with entity id 348185 at (243.87488773009312, 84.0, -4763.499441768881)
[03:43:37] [Server thread/INFO]: [Player]christrot: joined the game
[03:43:37] [Server thread/INFO]: Sending Player Data to player literal{christrot} with UUID b982df91-xxxx-xxxx-xxxx-33e8c71f4aa8.
So yeah, looks like it changes the joining message. It's strange that it's duplicating it though, as the console user list has:
But also a secondary user:
Ugh... that mod is messy. Okay, I can work around this. Thanks!
No problem! Yeah, I know I had some issues when I was doing analytics prior to amp implementing it.
My logic was basically gather the logic from the username cache and when they joined. (Because while mc collects the stats in one of the files, it's tick-based and if the server isn't running a full 20tps then the time can be wildly inaccurate.)
I basically just used the timestamp of the User Authenticated log which has their UUID and username and then build my stats on that regardless of their IGN. UUID being the db key so even if they changed their username on minecraft.net it'd just overwrite it in the stats.
When a player left or the server no longer responded [via health check] (Since that was an edge case I didn't catch originally) I'd just log that as a session.
[18:29:46] [Server thread/INFO]: christrot lost connection: Server closed
[18:29:46] [Server thread/INFO]: christrot: left the game
If you use the 'lost connection' log to indicate a leaving action, it always uses their unique-minecraft name to match it all back up, the left uses their ign which can be different.
Just as a heads up to anyone who hits the same issue and wants to fix it for an existing server's analytics - Open the instance's root dir ex: /home/amp/.ampdata/instances/INSTANCE_NAME then use something like vsCode's SQLite3 Editor to edit the db entries.
I ran:
DELETE FROM `UserSession` WHERE (`Username` like "%:%")
as all my 'extra' users had : in their username, so I targeted that.
Since it's in the AMP profile with read-only perms, you can do something like cp /home/amp/.ampdata/instances/INSTANCE_NAME/datastore.dat /home/$USER/; sudo chmod 755 datastore.dat then edit it as needed. Then do a cp datastore.dat /home/amp/.ampdata/instances/INSTANCE_NAME/datastore.dat which seems to automatically fix permissions.
note: You'll want to stop your instance before doing this to avoid data loss.
Ugh... that mod is messy. Okay, I can work around this. Thanks!
Any status on this? I have the same issue here after adding ranks via ftbranks in a neoforge modpack, if that helps.
Just as a heads up to anyone who hits the same issue and wants to fix it for an existing server's analytics - Open the instance's root dir ex:
/home/amp/.ampdata/instances/INSTANCE_NAMEthen use something like vsCode's SQLite3 Editor to edit the db entries.I ran:
DELETE FROM `UserSession` WHERE (`Username` like "%:%")as all my 'extra' users had
:in their username, so I targeted that.Since it's in the AMP profile with read-only perms, you can do something like
cp /home/amp/.ampdata/instances/INSTANCE_NAME/datastore.dat /home/$USER/; sudo chmod 755 datastore.datthen edit it as needed. Then do acp datastore.dat /home/amp/.ampdata/instances/INSTANCE_NAME/datastore.datwhich seems to automatically fix permissions.note: You'll want to stop your instance before doing this to avoid data loss.
This does only fix the analytics after the fact, not the live player list, right?
This does only fix the analytics after the fact, not the live player list, right?
Correct.
The rank names also seem to break the variables User and UserID in scheduler:
log output:
[07Nov.2025 17:15:03.900] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Invalid name or UUID
[07Nov.2025 17:15:03.900] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: tellraw [Veteran II]: DymondZ [ {"text":"!discord","color":"aqua"}, {"text":" → Get a link to our Discord server\n","color":"gray"}, {"text":"!rules","color":"green"}, {"text":" → View the server rules","color":"gray"} ]<--[HERE]
Hey, i had the same issue with this mod
https://modrinth.com/mod/dimension-viewer
BUT i had only the issue starting with 1.21.5 Minecraft
Could be, that there was some regex changings?
On 1.21.1 it works right, without changings.