Custom Player Data Example Addon v1.0.0
An example Better Than Wolves CE addon demonstrating how to attach and persist custom per-player data (stored in NBT), using a simple in-game counter that increases each time the player loads into a world.
What this example shows
This addon demonstrates how to:
- Add a new integer field (
customValue) to every player. - Save and load that data automatically using NBT.
- Preserve it across deaths, respawns, and world reloads.
- Display the value in chat to confirm it’s working.
When you join a world, you’ll see a message like:
[CustomPlayerData] You have joined this world 3 times.
This confirms that:
- The data is saved to the player’s NBT.
- It persists across sessions.
- It’s properly transferred when the player respawns.
You can use this same pattern to store any type of per-player data — integers, booleans, or strings — that you want to survive between play sessions.