[SOLVED] 1.3.1 - PlayerRespawnEvent & EXP Bar

Discussion in 'Plugin Development' started by cdncampbell, Aug 13, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    cdncampbell

    Good Day All,

    I have noticed an issue with 1.3.1 and the Exp Bar not updating when the following occurs:

    1.) On PlayerDeathEvent, I assign the exp for the player to spawn with (say 240 for this example) using the setNewExp() method.
    2.) On PlayerRespawnEvent, the Player object has the correct amount of exp (verified with the getTotalExperience() method).

    The problem is that upon respawn the player has the correct amount of exp, but the client's exp bar does not show the level or the current progress to the next level.

    Here is the weird part:
    • If a player then picks up 1exp orb the client updates and shows the correct level and the correct progress.
    • If the command of /xp 1 <playername> is issued the client is updated and shows the correct level and correct progress as well.
    I did some research and read that the event of PlayerExpChangeEvent is only called when "a players experience changes naturally". Considering the setNewExp() method is part of the event, shouldn't the exp assigned be "natural" and the PlayerExpChangeEvent be called to update the client?
    I have also tried the giveExp() method on the player object within the PlayerRespawnEvent handler and that does not work either.
    This is the last thing I need for my GraveRobber 2.0 release and I can not figure out why the exp bar is not reflecting the exp values that the player object has. I really hope it is something small that I have over looked :)
    Cheers
     
  2. Offline

    VoidWhisperer

    What you might want to try to do is set a sync delayed task to wait ~1 second after they die and try to set the xp, and see if that does anything.
     
  3. Offline

    cdncampbell

    That would be a good start, I am hoping I don't have to implement such a work around. Since this worked in 1.2.5 and is now broken in 1.3.1 I am thinking that this could be a bug of some sort?
     
  4. Offline

    VoidWhisperer

    Possibly, although it could be just the interface not updating.
     
  5. Offline

    cdncampbell

    Thanks for making me think about client bugs! This is a recorded minor bug in 1.3.1 as other players are having the same/similar issue; excerpt from the MineCraft Known Bugs Version 1.3.1 (here)
    So it looks like my plugin, GraveRobber, is now ready for a release :)
     
Thread Status:
Not open for further replies.

Share This Page