Class PlayerExperienceUtilsKt

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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