Xp Bar

Discussion in 'Plugin Development' started by 22vortex22, Nov 25, 2013.

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

    22vortex22

    Hey Guys I am currently working on a plugin and I was wondering how I could set the xp bar to half full.
     
  2. Offline

    hubeb

    i believe it has something to do with floats
     
  3. Offline

    xTrollxDudex

    22vortex22
    There are multiple ways of doing this:
    Player#setLevel(...)
    Player#setTotalExperience(...)
    and finally Player#setExp(...)
     
  4. Offline

    22vortex22

    Ik but what numbers would it have to be for those ways?
     
  5. Offline

    xTrollxDudex

  6. Offline

    22vortex22

    I keep doing


    player.setExp(.50F);



    and it does nothing
     
  7. Offline

    Johnzeh

    Well, I looked it up and I can see that there are 17 EXP points in the first level. So, in order to set it to half you would want half of 17 which would be 8.5. So if you wanted to set a players XP bar to half you would do player.setExp(8.5);
     
  8. Offline

    22vortex22

    Johnzeh doesn't work.. setExp uses a float since its a percentage

    Any solutions?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
Thread Status:
Not open for further replies.

Share This Page