Interface PlayerStatSet


public interface PlayerStatSet
Represents a handler for a data set
Data sets might be the kills, rank or the play time of the player
It has been built to be fully modular
There's only one global instance that's handling all players
  • Method Details

    • getId

      String getId()
      Returns the unique id of this data set
      This is being used for other plugins that might want to modify the data set and to make it easier for them
      It'll also be used for the %mbedwars_stats-<id>% PAPI placeholder
      And it'll also get stored inside the SQL database including getValue(PlayerStats) but with lower priority. Meaning they can get replaced by entries with the same key of PlayerStats. The reason why it's getting stored in the database as well is that it's being used for e.g. the ranking an webinterface
      Returns:
      The unique id of this data set
    • getPlugin

      Plugin getPlugin()
      Returns the plugin that's providing this data set
      Returns:
      The plugin behind the data set
    • getName

      String getName(@Nullable @Nullable CommandSender sender)
      Returns the name that shall be displayed everywhere
      Tip: Use Message.buildByKey(String, String) when you're saving the message in the messages file
      Parameters:
      sender - Shall return the name in the language of him. Can be null
      Returns:
      The name of this data set that'll be displayed to the users
    • getDisplayedValue

      String getDisplayedValue(PlayerStats stats)
      Returns what essentially will be displayed as the value
      Parameters:
      stats - The stats from which it should pick its info
      Returns:
      The displayed value
    • getValue

      Number getValue(PlayerStats stats)
      Similar to getDisplayedValue(PlayerStats), but as a direct number
      Will amongst other things be used for the leaderboard
      Parameters:
      stats - The stats from which it should pick its info
      Returns:
      The value of this prop set
      Throws:
      IllegalStateException - When this hasn't been implemented/not being supported or other reasons
    • setValue

      default void setValue(PlayerStats stats, Number value)
      Stat can implement this for easier use for others wanting to modify it
      Parameters:
      stats - The stats from which it should pick its info
      value - The new value
      Throws:
      IllegalStateException - When this hasn't been implemented/not being supported or other reasons
    • addValue

      default void addValue(PlayerStats stats, Number amount)
      Will add value to the current value
      Parameters:
      stats - The stats from which it should pick its info
      amount - How much it should add to the value
      Throws:
      IllegalStateException - When this hasn't been implemented/not being supported or other reasons
    • formatDouble

      default String formatDouble(Number num)
      Parameters:
      num - A number
      Returns:
      Returns the number with only two decimal places
    • formatInt

      default String formatInt(Number num)
      Parameters:
      num - A number
      Returns:
      Returns the number without any decimal places