Class ExperienceUtil

java.lang.Object
com.ranull.graves.util.ExperienceUtil

public final class ExperienceUtil extends Object
Utility class for handling experience-related operations for players.
  • Constructor Details

    • ExperienceUtil

      public ExperienceUtil()
  • Method Details

    • getPlayerExperience

      public static int getPlayerExperience(org.bukkit.entity.Player player)
      Gets the total experience of a player.
      Parameters:
      player - The player to get the experience from.
      Returns:
      The total experience of the player.
    • getExperienceAtLevel

      public static int getExperienceAtLevel(int level)
      Gets the experience required to reach a specific level.
      Parameters:
      level - The level to get the experience for.
      Returns:
      The experience required to reach the specified level.
    • getLevelFromExperience

      public static long getLevelFromExperience(long experience)
      Calculates the level from a given amount of experience.
      Parameters:
      experience - The experience to calculate the level from.
      Returns:
      The level corresponding to the given experience.
    • getDropPercent

      public static int getDropPercent(int experience, float percent)
      Calculates the drop percentage of experience.
      Parameters:
      experience - The total experience.
      percent - The percentage to drop.
      Returns:
      The experience drop amount.
    • getPlayerDropExperience

      @Deprecated public static int getPlayerDropExperience(org.bukkit.entity.Player player, float expStorePercent)
      Deprecated.

      This method is deprecated and will be removed in a future version. Use getLevelFromExperience(long) instead.

      Gets the amount of experience a player will drop upon death based on a percentage.
      Parameters:
      player - The player to get the drop experience from.
      expStorePercent - The percentage of experience to drop.
      Returns:
      The amount of experience to drop.