I would like to have a function to transform levels to XP so if I say 5 levels it transform it to equivalent XP from level 0 to 5. Another thing I would like to know is how to calculate wich level will the player have if I give him an XP quantity, so if the player has the level 25 and I give him 500 XP he'll have X levels (The same if removing it). Thanks for any help.
NemesisMate I think you can get the XP with http://jd.bukkit.org/rb/apidocs/org/bukkit/entity/Player.html#getTotalExperience() For the second, you can try to get the totalexperience for backup, add the xp to the player, get its level and set totalexperience back to the value before.
Tarestudio You misunderstood the first thing but I think I can get it with second solution too (I was looking for a better way, without having to change the xp of the player as trick). Anyway I'll try to do that way if not better is posted. Maybe could I do it with an "offline player"?
NemesisMate Sorry for the missunderstanding. For offlineplayer, I think you have to use listeners. On logout save the exp for the player, edit them in this field while they are offline, and on login write the edited value to the player.