StoreXP does store highest level a player achived not current experience
dn1s opened this issue ยท 4 comments
- DeadChest
- latest
- 1.20.1
- bukkit
Players end up with more experience than they had while dying.
Steps to reproduce the behavior:
- /expericence set D_N1S 50 levels
- get additional exp by killing a mob
- remove levels by enchanting
- die and pick up chest
Expected behavior
A player regains the experience he lost when dying, not highest experience he has achived.
I checked the spigotmc javadocs https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#getTotalExperience()
It's a bit confusing
This is correct:
This refers to the total amount of experience the player has collected over time and is not currently displayed to the client.
This is wrong in the docs:
Returns: Current total experience points
I think to fix this issue method computeXpToStore()
has to be changed to calculate current level from player.getLevel() + player.getExp()
Possible fix in #58