Understading getExperience, getTotalExperience, etc

Discussion in 'Plugin Development' started by darkhelmet, Dec 22, 2011.

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

    darkhelmet

    So I'm trying to allow users to buy xp in our custom server plugin. I can't seem to figure out the difference between Experience and TotalExperience. I'd assume experience is the xp in the current level but it's always showing as zero.

    When I try:

    Code:
    person.setExperience( person.getTotalExperience()+amount );
    It works but:

    - The green bars never show. If amount is 100 then I go to level 1.
    - Purchasing more XP is all wonky, because I don't think getTotalExperience is the right thing to use
    - However, getExperience is ALWAYS 0.

    I can't seem find any documentation on these or how they work.

    How can I properly add xp and get the green bars to work?

    CB 1597
     
  2. Offline

    Zicore

    Currently having the same issues...
    I miss a gainExp method

    EDIT: i just found giveExp(int i)
     
  3. Offline

    halley

    When debugging this, get the XP level and print it out to the log. Don't trust the client-- there's a few bugs where the XP doesn't update graphically when it should.
     
  4. Offline

    darkhelmet

    Wow good find! I don't know how I missed that but it seems to work well!
     
Thread Status:
Not open for further replies.

Share This Page