Class GaugeUpdater

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected GaugeUpdater​(@NotNull ExperienceTable experienceTable, boolean hideIfEmpty)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void dispose()
      Frees allocated resources.
      protected long getExperienceToNextLevel​(int level, long experience)
      Returns the experience needed to reach next level.
      protected int getPercentsToNextLevel​(int level, long experience)
      Returns the experience fraction of the current level.
      void setGauge​(@NotNull GUIGaugeListener gauge)
      Sets the gauge to update.
      protected void setValues​(int curValue, int minValue, int maxValue)
      Updates the gauge values.
      protected void setValues​(int curValue, int minValue, int maxValue, @NotNull java.lang.String labelText, @NotNull java.lang.String tooltipText)
      Updates the gauge values.
      • Methods inherited from class java.lang.Object

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

      • GaugeUpdater

        protected GaugeUpdater​(@NotNull
                               @NotNull ExperienceTable experienceTable,
                               boolean hideIfEmpty)
        Creates a new instance.
        Parameters:
        experienceTable - the experience table to query
        hideIfEmpty - if true the gauge will be hidden if all values are 0
    • Method Detail

      • dispose

        public abstract void dispose()
        Frees allocated resources.
      • setGauge

        public void setGauge​(@NotNull
                             @NotNull GUIGaugeListener gauge)
        Sets the gauge to update.
        Parameters:
        gauge - the gauge
      • setValues

        protected void setValues​(int curValue,
                                 int minValue,
                                 int maxValue)
        Updates the gauge values.
        Parameters:
        curValue - the current value
        minValue - the minimum value
        maxValue - the maximum value
      • setValues

        protected void setValues​(int curValue,
                                 int minValue,
                                 int maxValue,
                                 @NotNull
                                 @NotNull java.lang.String labelText,
                                 @NotNull
                                 @NotNull java.lang.String tooltipText)
        Updates the gauge values.
        Parameters:
        curValue - the current value
        minValue - the minimum value
        maxValue - the maximum value
        labelText - the text to draw on the gauge
        tooltipText - the tooltip suffix
      • getPercentsToNextLevel

        protected int getPercentsToNextLevel​(int level,
                                             long experience)
        Returns the experience fraction of the current level.
        Parameters:
        level - the level
        experience - the experience
        Returns:
        the fraction in percents
      • getExperienceToNextLevel

        protected long getExperienceToNextLevel​(int level,
                                                long experience)
        Returns the experience needed to reach next level.
        Parameters:
        level - the level
        experience - the experience
        Returns:
        the needed experience