Class PlayerData
java.lang.Object
studio.magemonkey.fabled.api.player.PlayerData
Represents one account for a player which can contain one class from each group
and the skills in each of those classes. You should not instantiate this class
yourself and instead get it from the Fabled static methods.
In order to get a player's data, use "Fabled.getData(...)". Do NOT try to instantiate your own PlayerData object.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionint
The current amount of attribute pointsThis represents the number of attribute points invested in each attributeThis represents the actual attribute level/stage -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttributeModifier
(String key, PlayerAttributeModifier modifier, boolean update) Adds attribute modifier to the player.void
addSkill
(Skill skill, PlayerClass parent) void
addSkillExternally
(Skill skill, PlayerClass parent, org.bukkit.NamespacedKey namespacedKey, int level) void
addStatModifier
(String key, PlayerStatModifier modifier, boolean update) Adds stat modifier to the player.void
Attempts to auto-level any skills that are able to do soboolean
bind
(org.bukkit.Material mat, PlayerSkill skill) Deprecated.boolean
canProfess
(FabledClass fabledClass) Checks whether the player can profess into the given class.boolean
Casts a skill by name for the player.boolean
cast
(PlayerSkill skill) Casts a skill for the player.boolean
check
(PlayerSkill skill, boolean cooldown, boolean mana) Checks the cooldown and mana requirements for a skillvoid
Deprecated.void
Clear all of the modifiers including stat modifier and attribute modifiervoid
Clear all attribute modifier which is not persistentboolean
clearBind
(org.bukkit.Material mat) Deprecated.void
clearBinds
(Skill skill) Deprecated.void
Clear all stat modifier which is not persistentboolean
downgradeSkill
(Skill skill) Downgrades a skill owned by the player.void
endInit()
Ends the initialization flag for the data.void
forceDownSkill
(PlayerSkill skill) Forcefully downgrades a skill, not letting other plugins stop it and ignoring any skill requirements to do so.void
forceDownSkill
(PlayerSkill skill, int amount) void
forceUpSkill
(PlayerSkill skill) Forcefully upgrades a skill, not letting other plugins cancel it and ignoring any requirements to do sovoid
forceUpSkill
(PlayerSkill skill, int amount) int
The current amount of attribute pointsint
getAttribute
(String key) Gets the number of attribute points the player has from invested and bonus sources.Retrieves the player's attribute data regarding total amounts spent.Get all attribute modifier from the player.int
Retrieves the current number of attribute points the player hasRetrieves a map of all player attribute totals.Retrieves the player's attribute data regarding current stages.int
getAttributeUpCost
(String key) Calculating cost using the formula: costBase + (int) Math.floor(attrStage*costModifier).int
getAttributeUpCost
(String key, Integer modifier) Calculating cost using the formula: costBase + (int) Math.floor(attrStage*costModifier).int
getAttributeUpCost
(String key, Integer from, Integer to) Calculating cost using the formula: costBase + (int) Math.floor(attrStage*costModifier).This represents the actual attribute level/stageHashMap
<org.bukkit.Material, PlayerSkill> getBinds()
Deprecated.getBoundSkill
(org.bukkit.Material mat) Deprecated.Retrieves the data of a class the player professed as by group.Retrieves the collection of the data for classes the player has professed as.The data for the player's combosstudio.magemonkey.codex.mccore.config.parse.DataSection
double
The hunger value here is not representative of the player's total hunger, rather the amount left of the next hunger point.int
Gets the number of attribute points invested in the given attributeRetrieves a map of all attributes the player invested.Retrieves a map of all attributes upgrade stages.int
Gets the upgrade stage of the given attributeint
double
Retrieves the data of the professed class under the main class group.double
getMana()
Retrieves the amount of mana the player currently hasdouble
double
Retrieves the max amount of mana the player can have including bonus managetPersistentData
(String key) Decrypt and return the saved values on the account.org.bukkit.entity.Player
Retrieves the Bukkit player object of the ownerRetrieves the name of the ownerint
org.bukkit.scheduler.BukkitTask
Retrieves the name of the active map menu scheme for the playerRetrieves the name of the class shown in the skill treeRetrieves a skill of the owner by name.Retrieves the skill bar data for the ownerint
getSkillLevel
(String name) Retrieves the level of a skill for the owner.Retrieves all of the skill data the player has.long
getStatModifiers
(String key) Get all stat modifier from the player.getUUID()
void
giveAttribPoints
(int amount) Gives the player attribute pointsboolean
giveAttribute
(String key, int amount) Upgrades the player attribute stage without costing attribute points.void
Gives experience to the player from the given sourcevoid
Gives experience to the player from the given sourceboolean
giveLevels
(int amount, ExpSource source) Gives levels to the player for all classes matching the experience sourcevoid
giveMana
(double amount) Gives mana to the player from an unknown source.void
giveMana
(double amount, ManaSource source) Gives mana to the player from the given mana source.void
givePoints
(int amount, ExpSource source) Deprecated.void
givePoints
(int amount, PointSource source) Gives skill points to the player for all classes matching the experience sourcevoid
Gives the player a skill outside of the normal class skills.void
giveSkill
(Skill skill, PlayerClass parent) Gives the player a skill using the class data as a parent.boolean
hasAttribute
(String key) Checks whether the player has any points invested in a given attributeboolean
hasClass()
Checks whether the player has as least one class they have professed as.boolean
Checks whether a player has a class within the given groupboolean
hasMana
(double amount) Checks whether the player has at least the specified amount of manaboolean
Checks if the owner has a skill by name.void
init
(org.bukkit.entity.Player player) Initializes the application of the data for the playerboolean
isBound
(org.bukkit.Material mat) Deprecated.boolean
isClass
(FabledClass fabledClass) Checks whether the player is professed as the class or any of its children.boolean
isExactClass
(FabledClass fabledClass) Checks whether the player is professed as the class without checking child classes.boolean
isInit()
boolean
void
loseExp()
Causes the player to lose experience as a penalty (generally for dying)void
loseExp
(double amount, boolean percent, boolean changeLevel, boolean showMessage) Causes the player to lose experience This will launch aPlayerExperienceLostEvent
event before taking the experience.void
loseLevels
(int amount) Causes the player to lose levelsboolean
Opens the attribute menu for the playerboolean
profess
(FabledClass fabledClass) Professes the player into the class if they are able to.void
record
(org.bukkit.entity.Player player) Records any data to save with class databoolean
refundAttribute
(String key, int refundAmount) Refunds an attribute point from the given attribute if there are any points invested in it.boolean
refundAttributeAll
(String key) Refunds all invested attribute points for the given attributeRefunds all spent attribute pointsvoid
refundSkill
(PlayerSkill skill) Refunds a skill for the player, resetting it down to level 0 and giving back any invested skill points.void
Refunds all skills for the playervoid
Regenerates mana for the player based on the regen amounts of professed classesvoid
removeAttributeModifier
(UUID uuid, boolean update) Remove attribute modifier with the exact uuidvoid
Remove a value with a specific keyvoid
removeSkillExternally
(Skill skill, org.bukkit.NamespacedKey namespacedKey) void
removeStatModifier
(UUID uuid, boolean update) Remove stat modifier with the exact uuidint
Resets the class data for the owner under the given group.void
resetAll()
Resets all profession data for the player.void
resetAttribs
(boolean refund) Resets attributes for the player.boolean
resetAttribute
(String key, boolean refund) Refunds all spent attribute points for a specific attributedouble
scaleDynamic
(EffectComponent component, String key, double value) Scales a dynamic skill's value using global modifiersdouble
Scales a stat value using the player's attributesdouble
Scales a stat value using the player's attributesvoid
setAttribPoints
(int attribPoints) The current amount of attribute pointssetClass
(FabledClass previous, FabledClass fabledClass, boolean reset) Sets the professed class for the player for the corresponding group.void
void
setHungerValue
(double hungerValue) void
setLastHealth
(double lastHealth) Used by the API for restoring health - do not use this.boolean
void
setMana
(double mana) Sets the player's amount of mana without launching eventsvoid
setOnPreviewStop
(Runnable onPreviewStop) Stops the current preview, if any, and registers the on-stop runnable for a new preview, if anyvoid
setPersistentData
(String key, Object data) Encrypt and save values to account for long-term storagevoid
setPoints
(int amount) Sets the skill point amount to the player for all classesvoid
Sets the active scheme name for the playerboolean
showDetails
(org.bukkit.entity.Player player) Shows the class details for the playerboolean
showProfession
(org.bukkit.entity.Player player) Shows profession options of the first class group availablevoid
Shows the skill tree for the player.boolean
showSkills
(org.bukkit.entity.Player player) Shows the skill tree for the player.boolean
showSkills
(org.bukkit.entity.Player player, PlayerClass playerClass) Shows the skill tree to the player for the given classvoid
startPassives
(org.bukkit.entity.Player player) Starts passive abilities for the player if they are online.void
stopSkills
(org.bukkit.entity.Player player) Stops passive abilities and events from triggering for the player if they are online.int
subtractHungerValue
(double amount) boolean
upAttribute
(String key) Invests a point in the attribute if the player has enough remaining attribute points.void
updateHealth
(org.bukkit.entity.Player player) Updates health of a player based on their current attributes and applyvoid
updatePlayerStat
(org.bukkit.entity.Player player) Updates all the stats of a player based on their current attributes This method is very heavy, consume resources and notable by player Checkout other method such asupdateWalkSpeed(Player)
for a light refresh
This also does not update the player equipment You will need to callPlayerEquips.update(Player)
before this function to update attribute/stats that comes with equipmentsvoid
Updates the scoreboard with the player's current class.void
updateWalkSpeed
(org.bukkit.entity.Player player) Updates walk speed of a player based on their current attributes and applyboolean
upgradeSkill
(Skill skill) Upgrades a skill owned by the player.void
useMana
(double amount) Takes mana away from the player for an unknown reason.void
Takes mana away from the player for the specified reason.
-
Field Details
-
attributes
This represents the number of attribute points invested in each attribute -
attrUpStages
This represents the actual attribute level/stage -
attribPoints
public int attribPointsThe current amount of attribute points
-
-
Method Details
-
getPlayer
public org.bukkit.entity.Player getPlayer()Retrieves the Bukkit player object of the owner- Returns:
- Bukkit player object of the owner or null if offline
-
getPlayerName
Retrieves the name of the owner- Returns:
- name of the owner
-
getUUID
-
getSkillBar
Retrieves the skill bar data for the owner- Returns:
- skill bar data of the owner
-
getCastBars
- Returns:
- cast bars data for the player
-
getTextCastingData
- Returns:
- cast bars data for the player
-
subtractHungerValue
public int subtractHungerValue(double amount) -
endInit
public void endInit()Ends the initialization flag for the data. Used by the API to avoid async issues. Do not use this in other plugins. -
getAttributes
Retrieves a map of all player attribute totals. Modifying the map will not change actual player attributes.- Returns:
- attribute totals
-
getInvestedAttributes
Retrieves a map of all attributes the player invested. This doesn't count base attributes from classes or bonus attributes from effects. Modifying the map will not change actual player attributes.- Returns:
- attribute totals
-
getInvestedAttributesStages
Retrieves a map of all attributes upgrade stages. This doesn't count base attributes from classes or bonus attributes from effects. Modifying the map will not change actual player attributes.- Returns:
- attribute upgrade stages
-
getAttribute
Gets the number of attribute points the player has from invested and bonus sources.- Parameters:
key
- attribute key- Returns:
- number of total points
-
getInvestedAttribute
Gets the number of attribute points invested in the given attribute- Parameters:
key
- attribute key- Returns:
- number of invested points
-
getInvestedAttributeStage
Gets the upgrade stage of the given attribute- Parameters:
key
- attribute key- Returns:
- the stage of the attribute
-
hasAttribute
Checks whether the player has any points invested in a given attribute- Parameters:
key
- attribute key- Returns:
- true if any points are invested, false otherwise
-
upAttribute
Invests a point in the attribute if the player has enough remaining attribute points. If the player has no remaining points, this will do nothing.- Parameters:
key
- attribute key- Returns:
- whether it was successfully upgraded
-
getAttributeUpCost
Calculating cost using the formula: costBase + (int) Math.floor(attrStage*costModifier).- Parameters:
key
- attribute key- Returns:
- calculated cost of single attribute upgrade
-
getAttributeUpCost
Calculating cost using the formula: costBase + (int) Math.floor(attrStage*costModifier).OVERLOAD to check cost of certain stage: mod = -1 is e.g. of previous stage, mod = 0 is e.g. of current stage, mod = 1 is e.g. default cost of next stage.
- Parameters:
key
- attribute keymodifier
- stage number modifier- Returns:
- calculated cost of single attribute upgrade
-
getAttributeUpCost
Calculating cost using the formula: costBase + (int) Math.floor(attrStage*costModifier).OVERLOAD to check total cost of upgrading [from] stage --> [to] stage where [from] is starting stage and where [to] is target stage
- Parameters:
key
- attribute keyfrom
- starting stageto
- target stage- Returns:
- calculated cost of single attribute upgrade
-
giveAttribute
Upgrades the player attribute stage without costing attribute points.- Parameters:
key
- attribute to give points foramount
- amount to give
-
addStatModifier
Adds stat modifier to the player. These bypass min/max invest amount and cannot be refunded.- Parameters:
key
- stat keymodifier
- The player stat modifierupdate
- calculate player stat immediately and apply to him
-
getStatModifiers
Get all stat modifier from the player.- Parameters:
key
- stat key- Returns:
- stat modifier list of the attribute given
-
addAttributeModifier
Adds attribute modifier to the player. These bypass min/max invest amount and cannot be refunded.- Parameters:
key
- attribute keymodifier
- The player attribute modifierupdate
- calculate player stat immediately and apply to him
-
getAttributeModifiers
Get all attribute modifier from the player.- Parameters:
key
- attribute key- Returns:
- attribute modifier list of the attribute given
-
refundAttributeAll
Refunds all invested attribute points for the given attribute- Parameters:
key
- attribute key- Returns:
- true if successful, false otherwise
-
refundAttribute
Refunds an attribute point from the given attribute if there are any points invested in it. If there are none, this will do nothing.- Parameters:
key
- attribute keyrefundAmount
- the number of points to refund
-
resetAttribute
Refunds all spent attribute points for a specific attribute- Parameters:
key
- attribute keyrefund
- whether to refund the points- Returns:
- true if successful, false otherwise
-
refundAttributes
Refunds all spent attribute points -
getAttributePoints
public int getAttributePoints()Retrieves the current number of attribute points the player has- Returns:
- attribute point total
-
giveAttribPoints
public void giveAttribPoints(int amount) Gives the player attribute points- Parameters:
amount
- amount of attribute points
-
scaleStat
Scales a stat value using the player's attributes- Parameters:
stat
- stat keybaseValue
- the default value come with vanilla Minecraft, Only needed for custom stats and Speed- Returns:
- modified value
-
scaleStat
Scales a stat value using the player's attributes- Parameters:
stat
- stat keydefaultValue
- the default value come with vanilla Minecraft, Only needed for custom stats and Speedmin
- min valuemax
- max value- Returns:
- modified value
-
scaleDynamic
Scales a dynamic skill's value using global modifiers- Parameters:
component
- component holding the valuekey
- key of the valuevalue
- unmodified value- Returns:
- the modified value
-
openAttributeMenu
public boolean openAttributeMenu()Opens the attribute menu for the player- Returns:
- true if successfully opened, false if conditions weren't met
-
getAttributeData
Retrieves the player's attribute data regarding total amounts spent. Modifying this will modify the player's actual data.- Returns:
- the player's attribute data
-
getAttributeStageData
Retrieves the player's attribute data regarding current stages. Modifying this will modify the player's actual data.- Returns:
- the player's attribute data
-
hasSkill
Checks if the owner has a skill by name. This is not case-sensitive and does not check to see if the skill is unlocked. It only checks if the skill is available to upgrade/use.- Parameters:
name
- name of the skill- Returns:
- true if has the skill, false otherwise
-
getSkill
Retrieves a skill of the owner by name. This is not case-sensitive.- Parameters:
name
- name of the skill- Returns:
- data for the skill or null if the player doesn't have the skill
-
getInvestedSkillPoints
public int getInvestedSkillPoints() -
getSkills
Retrieves all of the skill data the player has. Modifying this collection will not modify the player's owned skills but modifying one of the elements will change that element's data for the player.- Returns:
- collection of skill data for the owner
-
getExternallyAddedSkills
-
getSkillLevel
Retrieves the level of a skill for the owner. This is not case-sensitive.- Parameters:
name
- name of the skill- Returns:
- level of the skill or 0 if not found
-
giveSkill
Gives the player a skill outside of the normal class skills. This skill will not show up in a skill tree.- Parameters:
skill
- skill to give the player
-
giveSkill
Gives the player a skill using the class data as a parent. This skill will not show up in a skill tree.- Parameters:
skill
- skill to give the playerparent
- parent class data
-
addSkill
-
addSkillExternally
public void addSkillExternally(Skill skill, PlayerClass parent, org.bukkit.NamespacedKey namespacedKey, int level) -
removeSkillExternally
-
autoLevel
public void autoLevel()Attempts to auto-level any skills that are able to do so -
upgradeSkill
Upgrades a skill owned by the player. The player must own the skill, have enough skill points, meet the level and skill requirements, and not have maxed out the skill already in order to upgrade the skill. This will consume the skill point cost while upgrading the skill.- Parameters:
skill
- skill to upgrade- Returns:
- true if successfully was upgraded, false otherwise
-
forceUpSkill
Forcefully upgrades a skill, not letting other plugins cancel it and ignoring any requirements to do so- Parameters:
skill
- skill to forcefully upgrade
-
forceUpSkill
-
downgradeSkill
Downgrades a skill owned by the player. The player must own the skill and it must not currently be level 0 for the player to downgrade the skill. This will refund the skill point cost when downgrading the skill.- Parameters:
skill
- skill to downgrade- Returns:
- true if successfully downgraded, false otherwise
-
forceDownSkill
Forcefully downgrades a skill, not letting other plugins stop it and ignoring any skill requirements to do so.- Parameters:
skill
- skill to forcefully downgrade
-
forceDownSkill
-
refundSkill
Refunds a skill for the player, resetting it down to level 0 and giving back any invested skill points.- Parameters:
skill
- skill to refund
-
refundSkills
public void refundSkills()Refunds all skills for the player -
showSkills
public void showSkills()Shows the skill tree for the player. If the player has multiple trees, this will show the list of skill trees they can view. -
showDetails
public boolean showDetails(org.bukkit.entity.Player player) Shows the class details for the player- Parameters:
player
- player to show to- Returns:
- true if shown, false if nothing to show
-
showProfession
public boolean showProfession(org.bukkit.entity.Player player) Shows profession options of the first class group available- Parameters:
player
- player to show profession options for- Returns:
- true if shown profession options, false if none available
-
showSkills
public boolean showSkills(org.bukkit.entity.Player player) Shows the skill tree for the player. If the player has multiple trees, this will show the list of skill trees they can view.- Parameters:
player
- player to show the skill tree for- Returns:
- true if able to show the player, false otherwise
-
showSkills
Shows the skill tree to the player for the given class- Parameters:
player
- player to showplayerClass
- class to look for- Returns:
- true if succeeded, false otherwise
-
getShownClassName
Retrieves the name of the class shown in the skill tree- Returns:
- class name
-
hasClass
public boolean hasClass()Checks whether the player has as least one class they have professed as.- Returns:
- true if professed, false otherwise
-
hasClass
Checks whether a player has a class within the given group- Parameters:
group
- class group to check- Returns:
- true if has a class in the group, false otherwise
-
getClasses
Retrieves the collection of the data for classes the player has professed as.- Returns:
- collection of the data for professed classes
-
getClass
Retrieves the data of a class the player professed as by group. This is case-sensitive.- Parameters:
group
- group to get the profession for- Returns:
- professed class data or null if not professed for the group
-
getMainClass
Retrieves the data of the professed class under the main class group. The "main" group is determined by the setting in the config.- Returns:
- main professed class data or null if not professed for the main group
-
setClass
Sets the professed class for the player for the corresponding group.- Parameters:
previous
- the previously professed class, if anyfabledClass
- class to assign to the playerreset
- whether to reset the class data, specifically for changing classes to a class that is not a child of the previous one- Returns:
- the player-specific data for the new class
-
isExactClass
Checks whether the player is professed as the class without checking child classes.- Parameters:
fabledClass
- class to check- Returns:
- true if professed as the specific class, false otherwise
-
isClass
Checks whether the player is professed as the class or any of its children.- Parameters:
fabledClass
- class to check- Returns:
- true if professed as the class or one of its children, false otherwise
-
canProfess
Checks whether the player can profess into the given class. This checks to make sure the player is currently professed as the parent of the given class and is high enough of a level to do so.- Parameters:
fabledClass
- class to check- Returns:
- true if can profess, false otherwise
-
reset
Resets the class data for the owner under the given group. This will remove the profession entirely, leaving no remaining data until the player professes again to a starting class.- Parameters:
group
- group to resettoSubclass
- - whether we are professing to a subclass of the previous class- Returns:
- the number of skill points to be refunded
-
resetAll
public void resetAll()Resets all profession data for the player. This clears all professions the player has, leaving no remaining data until the player professes again to a starting class. -
resetAttribs
public void resetAttribs(boolean refund) Resets attributes for the player. If refunds are cancelled for any specific attribute, that attribute will not be reset.- Parameters:
refund
- whether to refund the points for the reset attributes
-
profess
Professes the player into the class if they are able to. This will reset the class data if the group options are set to reset upon profession. Otherwise, all skills, experience, and levels of the current class under the group will be retained and carried over into the new profession.- Parameters:
fabledClass
- class to profess into- Returns:
- true if successfully professed, false otherwise
-
giveExp
Gives experience to the player from the given source- Parameters:
amount
- amount of experience to givesource
- source of the experience
-
giveExp
Gives experience to the player from the given source- Parameters:
amount
- amount of experience to givesource
- source of the experiencemessage
- whether to show the configured message if enabled
-
loseExp
public void loseExp(double amount, boolean percent, boolean changeLevel, boolean showMessage) Causes the player to lose experience This will launch aPlayerExperienceLostEvent
event before taking the experience.- Parameters:
amount
- percent of experience to losepercent
- whether to take the amount as a percentagechangeLevel
- whether to change the level of the playershowMessage
- whether to show the configured message if enabled
-
loseExp
public void loseExp()Causes the player to lose experience as a penalty (generally for dying) -
setExp
-
giveLevels
Gives levels to the player for all classes matching the experience source- Parameters:
amount
- amount of levels to givesource
- source of the levels
-
loseLevels
public void loseLevels(int amount) Causes the player to lose levels -
setLevel
-
getPoints
public int getPoints() -
givePoints
Deprecated.SeegivePoints(int, PointSource)
insteadGives skill points to the player for all classes matching the experience source- Parameters:
amount
- amount of levels to givesource
- source of the levels
-
givePoints
Gives skill points to the player for all classes matching the experience source- Parameters:
amount
- amount of levels to givesource
- source of the levels
-
setPoints
public void setPoints(int amount) Sets the skill point amount to the player for all classes- Parameters:
amount
- amount of levels to set to
-
updatePlayerStat
public void updatePlayerStat(org.bukkit.entity.Player player) Updates all the stats of a player based on their current attributes This method is very heavy, consume resources and notable by player Checkout other method such asupdateWalkSpeed(Player)
for a light refresh
This also does not update the player equipment You will need to callPlayerEquips.update(Player)
before this function to update attribute/stats that comes with equipments -
updateWalkSpeed
public void updateWalkSpeed(org.bukkit.entity.Player player) Updates walk speed of a player based on their current attributes and apply- Parameters:
player
- the player
-
updateHealth
public void updateHealth(org.bukkit.entity.Player player) Updates health of a player based on their current attributes and apply- Parameters:
player
- the player
-
regenMana
public void regenMana()Regenerates mana for the player based on the regen amounts of professed classes -
giveMana
public void giveMana(double amount) Gives mana to the player from an unknown source. This will not cause the player's mana to go above their max amount.- Parameters:
amount
- amount of mana to give
-
giveMana
Gives mana to the player from the given mana source. This will not cause the player's mana to go above the max amount.- Parameters:
amount
- amount of mana to givesource
- source of the mana
-
useMana
public void useMana(double amount) Takes mana away from the player for an unknown reason. This will not cause the player to fall below 0 mana.- Parameters:
amount
- amount of mana to take away
-
useMana
Takes mana away from the player for the specified reason. This will not cause the player to fall below 0 mana.- Parameters:
amount
- amount of mana to take awaycost
- source of the mana cost
-
removeStatModifier
Remove stat modifier with the exact uuid- Parameters:
uuid
- The uuidupdate
- calculate player stat immediately and apply to him
-
clearStatModifier
public void clearStatModifier()Clear all stat modifier which is not persistent -
removeAttributeModifier
Remove attribute modifier with the exact uuid- Parameters:
uuid
- The uuidupdate
- calculate player stat immediately and apply to him
-
clearAttributeModifiers
public void clearAttributeModifiers()Clear all attribute modifier which is not persistent -
clearAllModifiers
public void clearAllModifiers()Clear all of the modifiers including stat modifier and attribute modifier -
getBoundSkill
Deprecated.Retrieves a skill the player has bound by material- Parameters:
mat
- material to get the bind for- Returns:
- skill bound to the material or null if none are bound
-
getBinds
Deprecated.Retrieves the bound data for the player. Modifying this map will modify the bindings the player has.- Returns:
- the skill binds data for the player
-
isBound
Deprecated.Checks whether the material has a skill bound to it- Parameters:
mat
- material to check- Returns:
- true if a skill is bound to it, false otherwise
-
bind
Deprecated.Binds a skill to a material for the player. The bind will not work if the skill was already bound to the material.- Parameters:
mat
- material to bind the skill toskill
- skill to bind to the material- Returns:
- true if was able to bind the skill, false otherwise
-
clearBind
Deprecated.Clears a skill binding on the material. If there is no binding on the material, this will do nothing.- Parameters:
mat
- material to clear bindings from- Returns:
- true if a binding was cleared, false otherwise
-
getPersistentData
Decrypt and return the saved values on the account.- Parameters:
key
- The key is used to save the value.- Returns:
- Decrypted value
-
setPersistentData
Encrypt and save values to account for long-term storage- Parameters:
key
- The key is used to save the value.data
- The value is stored. Currently supported types are: Number, String, Player, TempEntity, Entity
-
removePersistentData
Remove a value with a specific key- Parameters:
key
- The key is used to save the value.
-
getAllPersistentData
- Returns:
- original HashMap used to store persistent data
-
clearBinds
Deprecated.Clears the skill binding for the given skill. This will remove the bindings on all materials involving the skill.- Parameters:
skill
- skill to unbind
-
clearAllBinds
Deprecated.Clears all binds the player currently has -
record
public void record(org.bukkit.entity.Player player) Records any data to save with class data- Parameters:
player
- player to record for
-
updateScoreboard
public void updateScoreboard()Updates the scoreboard with the player's current class. This is already done by the API and doesn't need to be done by other plugins. -
startPassives
public void startPassives(org.bukkit.entity.Player player) Starts passive abilities for the player if they are online. This is already called by the API and shouldn't be called by other plugins.- Parameters:
player
- player to set the passive skills up for
-
stopSkills
public void stopSkills(org.bukkit.entity.Player player) Stops passive abilities and events from triggering for the player if they are online. This is already called by the API and shouldn't be called by other plugins.- Parameters:
player
- player to stop the passive skills for
-
cast
Casts a skill by name for the player. In order to cast the skill, the player must be online, have the skill unlocked, have enough mana, have the skill off cooldown, and have a proper target if applicable.- Parameters:
skillName
- name of the skill ot cast- Returns:
- true if successfully cast the skill, false otherwise
-
cast
Casts a skill for the player. In order to cast the skill, the player must be online, have the skill unlocked, have enough mana, have the skill off cooldown, and have a proper target if applicable.- Parameters:
skill
- skill to cast- Returns:
- true if successfully cast the skill, false otherwise
-
check
Checks the cooldown and mana requirements for a skill- Parameters:
skill
- skill to check forcooldown
- whether to check cooldownsmana
- whether to check mana requirements- Returns:
- true if can use
-
setOnPreviewStop
Stops the current preview, if any, and registers the on-stop runnable for a new preview, if any- Parameters:
onPreviewStop
- runnable to execute when the new preview stops
-
init
public void init(org.bukkit.entity.Player player) Initializes the application of the data for the player- Parameters:
player
- player to set up for
-
hasMana
public boolean hasMana(double amount) Checks whether the player has at least the specified amount of mana- Parameters:
amount
- required mana amount- Returns:
- true if has the amount of mana, false otherwise
-
getAttrUpStages
This represents the actual attribute level/stage -
getExtSkills
-
getAttributesModifiers
-
getStatModifiers
-
getPersistentData
-
getCooldownCache
-
getExtraData
public studio.magemonkey.codex.mccore.config.parse.DataSection getExtraData()- Returns:
- extra data attached to the player's account
-
getPlayerUUID
-
getComboData
The data for the player's combos- Returns:
- combo data for the player
-
getEquips
- Returns:
- equipped item data
-
getOnCooldown
-
getAttribPoints
public int getAttribPoints()The current amount of attribute points -
getScheme
Retrieves the name of the active map menu scheme for the player- Returns:
- map menu scheme name
-
getMenuClass
-
getMana
public double getMana()Retrieves the amount of mana the player currently has- Returns:
- current player mana
-
getMaxMana
public double getMaxMana()Retrieves the max amount of mana the player can have including bonus mana- Returns:
- max amount of mana the player can have
-
getLastHealth
public double getLastHealth()- Returns:
- health during last logout
-
getMaxHealth
public double getMaxHealth() -
getHungerValue
public double getHungerValue()The hunger value here is not representative of the player's total hunger, rather the amount left of the next hunger point. This is manipulated by attributes were if an attribute says a player has twice as much "hunger" as normal, this will go down by decimals to slow the decay of hunger.- Returns:
- amount of the next hunger point the player has
-
isInit
public boolean isInit() -
isPassive
public boolean isPassive() -
getSkillTimer
public long getSkillTimer() -
getRemoveTimer
public org.bukkit.scheduler.BukkitTask getRemoveTimer() -
getOnPreviewStop
-
setAttribPoints
public void setAttribPoints(int attribPoints) The current amount of attribute points- Parameters:
attribPoints
- amount of points to have
-
setScheme
Sets the active scheme name for the player- Parameters:
scheme
- name of the scheme
-
setMana
public void setMana(double mana) Sets the player's amount of mana without launching events- Parameters:
mana
- current mana
-
setLastHealth
public void setLastHealth(double lastHealth) Used by the API for restoring health - do not use this.- Parameters:
lastHealth
- health logged off with
-
setHungerValue
public void setHungerValue(double hungerValue) - Parameters:
hungerValue
- new hunger value
-
givePoints(int, PointSource)
instead