A minecraft datapack for detecting player name changes and updating scoreboards accordingly, using macros. (Only works in 1.20.2 or newer)
This repo provides a datapack for detecting player name changes, allowing you to update important scoreboards accordingly. For example, if you store the player's level on a scoreboard they will lose their level when they change their name. This pack is a very lightweight implementation and contains 1 scoreboard, 1 text_display entity (which should be in spawn chunks), and only performs 2 ticking score checks. If a new player joins the server it will add them to a storage database and anytime a user reconnects it performs a query to see if their name has changed.
- Add the datapack to your world or namespace
- Open the mcfunction named "scorelist" under functions/new_name
- Add lines to specify how scoreboards should be handled. $(old_name) is the player's old name and @s is the player. I also recommend resetting the old name to prevent possible overlap.
Cloud Wolf 🔨 |