Class PlayerExperienceUtilsKt
-
- All Implemented Interfaces:
public final class PlayerExperienceUtilsKt
-
-
Method Summary
Modifier and Type Method Description final static Integer
getTrueExperience(Player $self)
Calculate a player's total experience based on level and progress to next. final static Unit
addTrueExperience(Player $self, Integer exp)
Change a Player's experience. -
-
Method Detail
-
getTrueExperience
final static Integer getTrueExperience(Player $self)
Calculate a player's total experience based on level and progress to next.
- Returns:
the amount of experience the Player has
-
addTrueExperience
final static Unit addTrueExperience(Player $self, Integer exp)
Change a Player's experience.
This method is preferred over Player.giveExp. <br></br>In older versions the method does not take differences in exp per level into account. This leads to overlevelling when granting players large amounts of experience. <br></br>In modern versions, while differing amounts of experience per level are accounted for, the approach used is loop-heavy and requires an excessive number of calculations, which makes it quite slow.
- Parameters:
exp
- the amount of experience to add or remove
-
-
-
-