Class ExperienceTable


  • public class ExperienceTable
    extends java.lang.Object
    Stores experience <-> level mappings.
    • Constructor Summary

      Constructors 
      Constructor Description
      ExperienceTable()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getExperienceToNextLevel​(int currentLevel, long currentExp)
      Returns the experience needed to reach the next level.
      int getPercentsToNextLevel​(int currentLevel, long currentExp)
      Returns the experience fraction of the current level in percents.
      void setExpTable​(long @NotNull [] expTable)
      Updates the experience table information.
      • Methods inherited from class java.lang.Object

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

      • ExperienceTable

        public ExperienceTable()
    • Method Detail

      • getExperienceToNextLevel

        public long getExperienceToNextLevel​(int currentLevel,
                                             long currentExp)
        Returns the experience needed to reach the next level.
        Parameters:
        currentLevel - the current level
        currentExp - the current experience
        Returns:
        the experience to reach level currentLevel+1
      • getPercentsToNextLevel

        public int getPercentsToNextLevel​(int currentLevel,
                                          long currentExp)
        Returns the experience fraction of the current level in percents. The value starts at 0% when a new level has been gained; the next level is at 100%.
        Parameters:
        currentLevel - the current level
        currentExp - the current experience
        Returns:
        the experience fraction
      • setExpTable

        public void setExpTable​(long @NotNull [] expTable)
        Updates the experience table information.
        Parameters:
        expTable - the new experience table