Interface SkillsUser


public interface SkillsUser
  • Method Details

    • getUuid

      UUID getUuid()
      Gets the Minecraft UUID of the player.
      Returns:
      the player's UUID
    • isLoaded

      boolean isLoaded()
      Whether the instance represents an online user that is loaded into memory. If the user is not loaded, get methods will return default values and set methods will have no effect.
      Returns:
      whether the user is loaded
    • getSkillXp

      double getSkillXp(Skill skill)
      Gets the current amount of XP in a skill. The amount ranges from 0 to the XP required to progress to the next skill level.
      Parameters:
      skill - the skill to get XP from
      Returns:
      the XP amount
    • addSkillXp

      void addSkillXp(Skill skill, double amountToAdd)
      Adds XP to a skill as if earned in game. The final amount of XP added to the player may be modified by abilities and multipliers.
      Parameters:
      skill - the skill to add XP to
      amountToAdd - the amount of XP to add
    • addSkillXp

      void addSkillXp(Skill skill, double amountToAdd, XpSource source)
      Adds XP to a skill as if earned in game with a specific XP source. The final amount of XP added to the player may be modified by abilities and multipliers.
      Parameters:
      skill - the skill to add XP to
      amountToAdd - the amount of XP to add
      source - the source of the XP
    • addSkillXpRaw

      void addSkillXpRaw(Skill skill, double amountToAdd)
      Adds an exact amount of XP to a skill, bypassing in-game abilities and multipliers.
      Parameters:
      skill - the skill to add XP to
      amountToAdd - the exact amount of XP to add
    • setSkillXp

      void setSkillXp(Skill skill, double amount)
      Sets the XP of a skill to the given amount.
      Parameters:
      skill - the skill to set the XP of
      amount - the amount of XP to set
    • getSkillLevel

      int getSkillLevel(Skill skill)
      Gets the level of a skill.
      Parameters:
      skill - the skill to get the level of
      Returns:
      the skill level
    • setSkillLevel

      void setSkillLevel(Skill skill, int level)
      Sets the level of a skill.
      Parameters:
      skill - the skill to set the level of
      level - the level to set to
    • setSkillLevel

      void setSkillLevel(Skill skill, int level, boolean refresh)
      Sets the level of a skill.
      Parameters:
      skill - the skill to set the level of
      level - the level to set to
      refresh - whether to refresh stats, permissions, rewards, and item modifiers to account for the change in skill level
    • getSkillAverage

      double getSkillAverage()
      Gets the user's average skill level of all enabled skills.
      Returns:
      the skill average
    • getStatLevel

      double getStatLevel(Stat stat)
      Gets the level of a stat.
      Parameters:
      stat - the stat to get the level of
      Returns:
      the level of the stat
    • getBaseStatLevel

      double getBaseStatLevel(Stat stat)
      Gets the level of a stat without any stat modifiers. The base level is the amount obtained only from the permanent rewards for leveling skills.
      Parameters:
      stat - the stat to get the base level of
      Returns:
      the base stat level
    • getMana

      double getMana()
      Gets the current mana of the player.
      Returns:
      the current mana
    • getMaxMana

      double getMaxMana()
      Gets the maximum mana of the player.
      Returns:
      the maximum mana
    • setMana

      void setMana(double mana)
      Sets the mana of the player.
      Parameters:
      mana - the amount of mana to set
    • consumeMana

      boolean consumeMana(double amount)
      Attempts to consume the specified amount of mana, simulating using a mana ability. Will only consume if the user's mana is greater than or equal to amount. If the player does not have enough mana, a "Not enough mana" message will be sent to the user's action bar. Does not send any message if successful, you must handle that.
      Parameters:
      amount - the amount to consume
      Returns:
      true if the user had enough mana and the operation was successful, false if not
    • getPowerLevel

      int getPowerLevel()
      Gets the power level of the player. The power level is the sum of all skill levels.
      Returns:
      the power level
    • addStatModifier

      void addStatModifier(StatModifier statModifier)
      Adds a stat modifier to the player. Stat modifiers are temporary changes to a stat that require a name to be identified and removed.
      Parameters:
      statModifier - the stat modifier to add
    • removeStatModifier

      void removeStatModifier(String name)
      Removes a stat modifier from the player.
      Parameters:
      name - the name of the stat modifier to remove
    • getStatModifier

      @Nullable @Nullable StatModifier getStatModifier(String name)
      Gets a stat modifier from its name.
      Parameters:
      name - the name of the modifier
      Returns:
      the stat modifier, or null if none exists with the name.
    • getStatModifiers

      Map<String,StatModifier> getStatModifiers()
      Gets a map of all the user's stat modifiers.
      Returns:
      the map of all stat modifiers
    • addTraitModifier

      void addTraitModifier(TraitModifier traitModifier)
      Adds a trait modifier to the player.
      Parameters:
      traitModifier - the trait modifier
    • removeTraitModifier

      void removeTraitModifier(String name)
      Removes a trait modifier from the player with a given name.
      Parameters:
      name - the name of the trait modifier to remove
    • getTraitModifier

      @Nullable @Nullable TraitModifier getTraitModifier(String name)
      Gets a trait modifier from its name
      Parameters:
      name - the name of the modifier
      Returns:
      the trait modifier, or null if none exists with the name.
    • getTraitModifiers

      Map<String,TraitModifier> getTraitModifiers()
      Gets a map of all the user's trait modifiers.
      Returns:
      the map of all trait modifiers
    • getEffectiveTraitLevel

      double getEffectiveTraitLevel(Trait trait)
      Gets the total level of a trait, including non-plugin base values.
      Parameters:
      trait - the trait to get the level of
      Returns:
      the total effective level
    • getBonusTraitLevel

      double getBonusTraitLevel(Trait trait)
      Gets the level of a trait from only the plugin's stats and trait modifiers.
      Parameters:
      trait - the trait to get the level of
      Returns:
      the bonus trait level
    • getAbilityLevel

      int getAbilityLevel(Ability ability)
      Gets the level of an ability.
      Parameters:
      ability - the ability to get the level of
      Returns:
      the level of the ability
    • getManaAbilityLevel

      int getManaAbilityLevel(ManaAbility manaAbility)
      Gets the level of a mana ability.
      Parameters:
      manaAbility - the mana ability to get the level of
      Returns:
      the level of the mana ability
    • getLocale

      Locale getLocale()
      Gets the locale of the player, or the server default locale if the player has not set a locale.
      Returns:
      the locale of the player
    • hasSkillPermission

      boolean hasSkillPermission(Skill skill)
      Gets whether the player the permission node to use a skill. The checked node is the format auraskills.skill.[skillName], which is true by default.
      Parameters:
      skill - the skill to check
      Returns:
      whether the player has the permission
    • getJobs

      Set<Skill> getJobs()
      Gets the player's active jobs. Returns an empty set if the user has no jobs or if jobs are not enabled. The returned set cannot be modified, use addJob(Skill) and removeJob(Skill) to change player jobs.
      Returns:
      the set of active jobs
    • addJob

      void addJob(Skill job)
      Adds a skill as an active job.
      Parameters:
      job - the skill to add as a job
    • removeJob

      void removeJob(Skill job)
      Removes a skill from the player's active jobs.
      Parameters:
      job - the job to remove
    • clearAllJobs

      void clearAllJobs()
      Removes all active jobs.
    • getJobLimit

      int getJobLimit()
      Gets the maximum number of jobs the player can have active at once.
      Returns:
      the jobs limit
    • sendActionBar

      void sendActionBar(String message)
      Sends an action bar to the user and pauses other AuraSkills action bars for the default duration (750ms or 15 ticks).
      Parameters:
      message - the message to send
    • sendActionBar

      void sendActionBar(String message, int duration, TimeUnit timeUnit)
      Sends an action bar to the user and pauses other AuraSkills action bars for the specified duration.
      Parameters:
      message - the action bar message
      duration - the duration
      timeUnit - the time unit of the duration
    • pauseActionBar

      void pauseActionBar(int duration, TimeUnit timeUnit)
      Pauses AuraSkills action bars for a certain duration. While idle and xp action bars will be paused, others like ability messages may still be sent.
      Parameters:
      duration - the duration to pause
      timeUnit - the time unit of the duration
    • save

      CompletableFuture<Boolean> save(boolean removeFromMemory)
      Saves the user to persistent storage asynchronously. This is only recommended if the SkillsUser represents an offline user, as changes for online users are saved automatically on logout.
      Parameters:
      removeFromMemory - Whether to remove the user from memory after saving. Will not work if the user is online.
      Returns:
      A future signaling when the saving is complete. The future's value is true if successful, and false if an exception was thrown.