mojira.dev
MC-169576

Xp Query can be 1 off. XpTotal isn't always accurate.

Starting from 0 levels and xp, I do 

/xp set @s 10 levels

which is a total of 160 pts. I then use

/xp add @s -100 points

then

/xp query @s points

, and it tells me I have 4 points while I can see that I have 5 levels which is a total of 59 points, which doesn't make sense because 160-100 doesn't = 59.

After this, I subtract 4 levels and the query tells me I have 0 points, yet there's a green notch filled at the bottom. Subtracting 1 again gives puts me at level 4 with the entire green bar filled up.

If I start from 0 levels and xp and do

/xp set @s 5 levels

the query says I have 0 points and the green notch isn't filled.

 

This is bad because storing the result of the query in the score can be 1 off and XpTotal doesn't always accurately show the total Xp. "xp" can be used as a criteria for a score, but it doesn't take into account the Xp a player already had before being assigned and it also doesn't update from certain commands like

/xp set <target> # levels

Linked issues

Comments 6

I believe this is covered by MC-118008. Please leave a comment if I'm wrong here

The XpTotal part of that post is the same, but not the /xp query part. That post says that /xp query also doesn't take level changes into account, but I always thought that /xp query had nothing to do with the xp level, and that it onlly shows the current points to the next level.

What I posted is that sometimes it's a point less than what it really is. /xp query said I have 59 points, when I really had 60. I've tested it with other amounts and it was sometimes a point off for those amounts too.

Hm, so maybe similar to MC-123270 then?

Yeah I think that's it. How do you request for another version to be a added to the bug report, do you post it in the comments? I feel like both of those bug reports should have 1.15.1 added.

ryu3025

(Unassigned)

Confirmed

(Unassigned)

1.15.1, 1.16.4

Retrieved