HomeJavaDatapacksScoreFixer
ScoreFixer
DatapacksJava

ScoreFixer

by SilicatYT · on Modrinth

Which Minecraft do you have?

Every version of the game needs its own build. Pick yours, then download — the wrong build installs fine and then does nothing in the game. This mod is built for Data pack only.

⬇ Download for 1.21.5–26.2⬇ Download for 1.21–1.21.4⬇ Download for 1.20.5–1.20.6
I don't know my version or loader
Open the Minecraft launcher and look at the profile you play on — it names both, like fabric-loader-1.21.4. The version also shows in the bottom-right corner of the game's main menu.
No loader in the profile name? Then it's plain Minecraft, and these mods won't run — you need Fabric or NeoForge installed first.

ScoreFixer

A robust Minecraft Data Pack library that prevents scoreboard values from getting lost after a player name change.
For inquiries, please contact @silicatYT on Discord.

Download: Modrinth
Issue tracker: GitHub

Why is this necessary?

In Minecraft, scores are tied to usernames rather than UUIDs. As such, changing your name resets your previously held scores (which can break Data Packs or lose progress), and anyone joining with your old name can take over your previous scores.
ScoreFixer tackles this issue and lets you automatically transfer scores to your new name without conflicts.

Features

How to use

Make scores transfer on name change

To make ScoreFixer automatically transfer objectives (e.g. "foo" & "bar") on name changes, run /function score_fixer:util/track_objectives {Objectives:["foo", "bar"]}.

To untrack objectives again, run /function score_fixer:util/untrack_objectives {Objectives:["foo", "bar"]}.

Alternatively, you can directly add or remove {Name:"foo"} to/from the score_fixer:objectives List data storage.

Access offline players' scores Load

You can access offline players' scores with their UUID by running /function score_fixer:util/load_with_uuid {UUID:...} (accepts hexadecimal and int array format). If a player is found, their data is copied to score_fixer:loaded Players. From there, you can make changes (adjust score values, remove objectives from the list to reset them, etc).
Alternatively, you can manually copy data from every player that matches your custom condition like so:

/data modify storage score_fixer:loaded Players append from storage score_fixer:zprivate Maps[{Objectives:[{Name:"foo",Value:10}]}]
Save

After applying changes to the objectives in score_fixer:loaded Players, run /function score_fixer:util/save to save the data for all loaded players at once.

Events

The data inside score_fixer:event Data is also directly accessible using macros.

Upgrade or uninstall ScoreFixer

Good to know

Known bugs (Singleplayer exclusive)

The reason for not being able to detect joins of previously online players after a crash is that they will be removed from the server without their leave_game score increasing. It is singleplayer exclusive due to it being fixable as long as at least 1 tick passes between a player leaving due to a crash and them rejoining, which is guaranteed on servers.

The reason for not being able to carry over scores when names only differ in their capitalization is that /scoreboard commands automatically convert a name's capitalization to a matching online player name's capitalization. This makes it impossible to fetch or set an offline player's score if someone else with the same name (but different capitalization) is online. It is singleplayer exclusive due to it being fixable as long as at least 1 tick passes between a player leaving and a player with the same name but different capitalization joining, which is guaranteed on servers.

Caveats to ScoreFixer Lantern Load

ScoreFixer supports Lantern Load, a convention that lets you specify dependencies (incl. versions) and control the order in which Data Packs run. It is vital that ScoreFixer loads and ticks before your Data Pack, so that scores can be assigned to the new player names before your Data Pack checks them.

Credit

From CMDred:

Additional help:

License

As per the MIT License, you are allowed to redistribute, modify and use ScoreFixer as long as you provide credit for the original work.

Quick facts

Install steps are the general flow for this file type — see the MC Java Mods guides for the full walkthrough.

Verified by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more