DeadChest

DeadChest

187k Downloads

StoreXP does store highest level a player achived not current experience

dn1s opened this issue ยท 4 comments

commented
  • DeadChest
  • latest
  • 1.20.1
  • bukkit

Players end up with more experience than they had while dying.

Steps to reproduce the behavior:

  1. /expericence set D_N1S 50 levels
  2. get additional exp by killing a mob
  3. remove levels by enchanting
  4. die and pick up chest

Expected behavior
A player regains the experience he lost when dying, not highest experience he has achived.

Screenshots
Dying with level 47:
2023-06-19_14 34 56

Got chest and ended up being level 98:
2023-06-19_14 37 12

commented

Thanks for the good report ! I will look at that

commented

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()

commented

Possible fix in #58

commented

Fixed on 1.16.1