Package studio.magemonkey.fabled.manager
Class FabledAttribute
java.lang.Object
studio.magemonkey.fabled.manager.FabledAttribute
- All Implemented Interfaces:
IconHolder
A single attribute template
-
Constructor Summary
ConstructorsConstructorDescriptionFabledAttribute
(studio.magemonkey.codex.mccore.config.parse.DataSection data, String key) Creates a new attribute, loading the settings from the given config data. -
Method Summary
Modifier and TypeMethodDescriptionint
Retrieves the starting cost of the attribute upgrade.double
Retrieves the raw additional cost of the attribute upgrade.org.bukkit.inventory.ItemStack
getIcon
(PlayerData data) Retrieves the icon for the attributegetKey()
Retrieves the config key of the attributeint
getMax()
Retrieves the max amount the attribute can be raised togetName()
Retrieves the name for the attributeorg.bukkit.inventory.ItemStack
boolean
isAllowed
(org.bukkit.entity.Player player) double
modify
(EffectComponent component, String key, double value, int amount) Modifies a dynamic condition's valuedouble
modifyStat
(String key, double base, int amount) Modifies a stat valuevoid
setCostModifier
(double costModifier) Retrieves the raw additional cost of the attribute upgrade.void
setMax
(int max) Sets the max level for the attribute
-
Constructor Details
-
FabledAttribute
Creates a new attribute, loading the settings from the given config data.- Parameters:
data
- config data to load fromkey
- the key the attribute was labeled under
-
-
Method Details
-
getName
Retrieves the name for the attribute- Returns:
- name of the attribute
-
getIcon
Retrieves the icon for the attribute- Specified by:
getIcon
in interfaceIconHolder
- Returns:
- icon of the attribute
-
isAllowed
public boolean isAllowed(org.bukkit.entity.Player player) - Specified by:
isAllowed
in interfaceIconHolder
-
getToolIcon
public org.bukkit.inventory.ItemStack getToolIcon()- Returns:
- icon for the attribute for use in the GUI editor
-
modify
Modifies a dynamic condition's value- Parameters:
component
- component to modify forkey
- key of the value to modifyvalue
- base valueamount
- amount of attribute points- Returns:
- modified value
-
modifyStat
Modifies a stat value- Parameters:
key
- key of the statbase
- base value of the statamount
- amount of attribute points- Returns:
- modified stat value
-
getKey
Retrieves the config key of the attribute- Returns:
- config key of the attribute
-
getMax
public int getMax()Retrieves the max amount the attribute can be raised to- Returns:
- max attribute amount
-
setMax
public void setMax(int max) Sets the max level for the attribute -
getCostBase
public int getCostBase()Retrieves the starting cost of the attribute upgrade.- Returns:
- costBase amount
-
getCostModifier
public double getCostModifier()Retrieves the raw additional cost of the attribute upgrade. It should be converted to int e.g. using (int) Math.floor function.- Returns:
- costModifier
-
setCostModifier
public void setCostModifier(double costModifier) Retrieves the raw additional cost of the attribute upgrade. It should be converted to int e.g. using (int) Math.floor function.
-