I'm trying to give a player certain amount of experience when it respawns. Everything works fine, except the part of actually 'giving' the experience. I've tried player.setTotalExperience(amount) but I read that you shouldn't use this and I therefore tried player.giveExp(amount). Although this does work, it doesn't update the xp bar properly. When a player tries to enchant something, it can't. Because his/her level is still 0. I've tried this custom class: https://github.com/aadnk/Experience...omphenix/xp/rewards/xp/ExperienceManager.java, but that didn't work either. Do you guys have any ideas?
Hmmm I've never tried messing with total experience much, aside from giving myself level 9001 to show off ;P I know that on xbox version of Minecraft, it is fine to change the value of totalExperience and set it to a float, and nothing bad can happen unless you mess the hex up But that's not really relevant Where did it say don't use setTotalExperience() ? and why?
The page: http://forums.bukkit.org/threads/settotalexperience-does-not-work.103475/ I find it strange that Bukkit doesn't have working methods for experience. Although they work for a bit, they don't actually update the xpbar? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
The problem is probably that you're giving it to them when they're dead. Schedule a sync task for like 3 ticks later then set their experience. I had this problem with potioneffects.
Yeah that's a problem. PlayerRespawnEvent fire before they respawn, that's why you can do e.setRespawnLocation
Ah, ok. Thanks! It seems to work. Thanks again! EDIT by Moderator: merged posts, please use the edit button instead of double posting.