Package dev.aurelium.auraskills.api.user
Interface SkillsUser
public interface SkillsUser
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a skill as an active job.voidaddSkillXp(Skill skill, double amountToAdd) Adds XP to a skill as if earned in game.voidaddSkillXp(Skill skill, double amountToAdd, XpSource source) Adds XP to a skill as if earned in game with a specific XP source.voidaddSkillXpRaw(Skill skill, double amountToAdd) Adds an exact amount of XP to a skill, bypassing in-game abilities and multipliers.voidaddStatModifier(StatModifier statModifier) Adds a stat modifier to the player.voidaddTraitModifier(TraitModifier traitModifier) Adds a trait modifier to the player.voidRemoves all active jobs.booleanconsumeMana(double amount) Attempts to consume the specified amount of mana, simulating using a mana ability.intgetAbilityLevel(Ability ability) Gets the level of an ability.doublegetBaseStatLevel(Stat stat) Gets the level of a stat without any stat modifiers.doublegetBonusTraitLevel(Trait trait) Gets the level of a trait from only the plugin's stats and trait modifiers.doublegetEffectiveTraitLevel(Trait trait) Gets the total level of a trait, including non-plugin base values.intGets the maximum number of jobs the player can have active at once.getJobs()Gets the player's active jobs.Gets the locale of the player, or the server default locale if the player has not set a locale.doublegetMana()Gets the current mana of the player.intgetManaAbilityLevel(ManaAbility manaAbility) Gets the level of a mana ability.doubleGets the maximum mana of the player.intGets the power level of the player.doubleGets the user's average skill level of all enabled skills.intgetSkillLevel(Skill skill) Gets the level of a skill.doublegetSkillXp(Skill skill) Gets the current amount of XP in a skill.doublegetStatLevel(Stat stat) Gets the level of a stat.@Nullable StatModifiergetStatModifier(String name) Gets a stat modifier from its name.Gets a map of all the user's stat modifiers.@Nullable TraitModifiergetTraitModifier(String name) Gets a trait modifier from its nameGets a map of all the user's trait modifiers.getUuid()Gets the Minecraft UUID of the player.booleanhasSkillPermission(Skill skill) Gets whether the player the permission node to use a skill.booleanisLoaded()Whether the instance represents an online user that is loaded into memory.voidpauseActionBar(int duration, TimeUnit timeUnit) Pauses AuraSkills action bars for a certain duration.voidRemoves a skill from the player's active jobs.voidremoveStatModifier(String name) Removes a stat modifier from the player.voidremoveTraitModifier(String name) Removes a trait modifier from the player with a given name.save(boolean removeFromMemory) Saves the user to persistent storage asynchronously.voidsendActionBar(String message) Sends an action bar to the user and pauses other AuraSkills action bars for the default duration (750ms or 15 ticks).voidsendActionBar(String message, int duration, TimeUnit timeUnit) Sends an action bar to the user and pauses other AuraSkills action bars for the specified duration.voidsetMana(double mana) Sets the mana of the player.voidsetSkillLevel(Skill skill, int level) Sets the level of a skill.voidsetSkillLevel(Skill skill, int level, boolean refresh) Sets the level of a skill.voidsetSkillXp(Skill skill, double amount) Sets the XP of a skill to the given amount.
-
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
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
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 toamountToAdd- the amount of XP to add
-
addSkillXp
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 toamountToAdd- the amount of XP to addsource- the source of the XP
-
addSkillXpRaw
Adds an exact amount of XP to a skill, bypassing in-game abilities and multipliers.- Parameters:
skill- the skill to add XP toamountToAdd- the exact amount of XP to add
-
setSkillXp
Sets the XP of a skill to the given amount.- Parameters:
skill- the skill to set the XP ofamount- the amount of XP to set
-
getSkillLevel
Gets the level of a skill.- Parameters:
skill- the skill to get the level of- Returns:
- the skill level
-
setSkillLevel
Sets the level of a skill.- Parameters:
skill- the skill to set the level oflevel- the level to set to
-
setSkillLevel
Sets the level of a skill.- Parameters:
skill- the skill to set the level oflevel- the level to set torefresh- 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
Gets the level of a stat.- Parameters:
stat- the stat to get the level of- Returns:
- the level of the stat
-
getBaseStatLevel
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
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
Removes a stat modifier from the player.- Parameters:
name- the name of the stat modifier to remove
-
getStatModifier
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
Adds a trait modifier to the player.- Parameters:
traitModifier- the trait modifier
-
removeTraitModifier
Removes a trait modifier from the player with a given name.- Parameters:
name- the name of the trait modifier to remove
-
getTraitModifier
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
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
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
Gets the level of an ability.- Parameters:
ability- the ability to get the level of- Returns:
- the level of the ability
-
getManaAbilityLevel
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
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
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, useaddJob(Skill)andremoveJob(Skill)to change player jobs.- Returns:
- the set of active jobs
-
addJob
Adds a skill as an active job.- Parameters:
job- the skill to add as a job
-
removeJob
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
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
Sends an action bar to the user and pauses other AuraSkills action bars for the specified duration.- Parameters:
message- the action bar messageduration- the durationtimeUnit- the time unit of the duration
-
pauseActionBar
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 pausetimeUnit- the time unit of the duration
-
save
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.
-