Package dev.aurelium.auraskills.api.user
Interface SkillsUser
public interface SkillsUser
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSkillXp
(Skill skill, double amountToAdd) Adds XP to a skill as if earned in game.void
addSkillXp
(Skill skill, double amountToAdd, XpSource source) Adds XP to a skill as if earned in game with a specific XP source.void
addSkillXpRaw
(Skill skill, double amountToAdd) Adds an exact amount of XP to a skill, bypassing in-game abilities and multipliers.void
addStatModifier
(StatModifier statModifier) Adds a stat modifier to the player.void
addTraitModifier
(TraitModifier traitModifier) Adds a trait modifier to the player.boolean
consumeMana
(double amount) Attempts to consume the specified amount of mana, simulating using a mana ability.int
getAbilityLevel
(Ability ability) Gets the level of an ability.double
getBaseStatLevel
(Stat stat) Gets the level of a stat without any stat modifiers.double
getBonusTraitLevel
(Trait trait) Gets the level of a trait from only the plugin's stats and trait modifiers.double
getEffectiveTraitLevel
(Trait trait) Gets the total level of a trait, including non-plugin base values.Gets the locale of the player, or the server default locale if the player has not set a locale.double
getMana()
Gets the current mana of the player.int
getManaAbilityLevel
(ManaAbility manaAbility) Gets the level of a mana ability.double
Gets the maximum mana of the player.int
Gets the power level of the player.double
Gets the user's average skill level of all enabled skills.int
getSkillLevel
(Skill skill) Gets the level of a skill.double
getSkillXp
(Skill skill) Gets the current amount of XP in a skill.double
getStatLevel
(Stat stat) Gets the level of a stat.@Nullable StatModifier
getStatModifier
(String name) Gets a stat modifier from its name.Gets a map of all the user's stat modifiers.@Nullable TraitModifier
getTraitModifier
(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.boolean
hasSkillPermission
(Skill skill) Gets whether the player the permission node to use a skill.boolean
isLoaded()
Whether the instance represents an online user that is loaded into memory.void
removeStatModifier
(String name) Removes a stat modifier from the player.void
removeTraitModifier
(String name) Removes a trait modifier from the player with a given name.void
setMana
(double mana) Sets the mana of the player.void
setSkillLevel
(Skill skill, int level) Sets the level of a skill.void
setSkillXp
(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
-
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
-