Class FabledClass
java.lang.Object
studio.magemonkey.fabled.api.classes.FabledClass
- All Implemented Interfaces:
IconHolder
- Direct Known Subclasses:
DynamicClass
Represents a template for a class used in the RPG system. This is
the class to extend when creating your own classes.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
FabledClass
(String name, org.bukkit.inventory.ItemStack icon, int maxLevel) Initializes a class template that does not profess from other classes but is rather a starting class.protected
FabledClass
(String name, org.bukkit.inventory.ItemStack icon, int maxLevel, String parent) Initializes a class template that can profess from the parent class when that class reaches its max level.protected
FabledClass
(String name, org.bukkit.inventory.ItemStack icon, int maxLevel, String group, String parent) Initializes a class template that can profess from the parent class when that class reaches its max level. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a skill to the class by name.void
Adds multiple skills to the class by name.void
allowExpSource
(ExpSource source) Adds an experience source to the list of allowed sources for the class.void
arrange()
Arranges the skill tree for the classboolean
canStartCombo
(Click click, org.bukkit.inventory.ItemStack itemStack) boolean
canUse
(org.bukkit.Material type) void
disallowExpSource
(ExpSource source) Removes an experience source from the list of allowed sources for the class.int
getAttribute
(String key, int level) Gets the class attribute amount for the given leveldouble
Retrieves the base amount of health for the classdouble
Retrieves the base amount of mana for the classgetGroup()
Retrieves the group this class falls inRetrieves the settings for the class's groupdouble
getHealth
(int level) Retrieves the amount of max health this class providesdouble
Retrieves the amount of health gained per level for the classorg.bukkit.inventory.ItemStack
getIcon()
Retrieves the icon representing this class for menusorg.bukkit.inventory.ItemStack
getIcon
(PlayerData data) Retrieves the icon representing this class for menusdouble
getMana
(int level) Retrieves the amount of max mana this class providesRetrieves the alias for mana this class usesdouble
Retrieves the amount of mana regeneration this class hasdouble
Retrieves the amount of mana gained per level for the classint
Retrieves the max level in which this class can reachgetName()
Retrieves the name of the classRetrieves the list of child classes that the player has as options to profess into upon reaching max level.Retrieves the parent of this classRetrieves the prefix of the classorg.bukkit.ChatColor
Retrieves the color of the class's prefixint
getRequiredExp
(int level) Retrieves the required amount of experience this class need to levelgetRoot()
Retrieves the settings for the class in a read-only formatRetrieves the list of skills this class provides a playergetSkills
(boolean includeParent) Retrieves the list of skills this class provides a playerRetrieves the skill tree representing the class skillsorg.bukkit.inventory.ItemStack
Gets the indicator for the class for the GUI toolsboolean
boolean
Checks whether this class has mana regenerationboolean
Checks whether the class professes from another classboolean
isAllowed
(org.bukkit.entity.Player player) boolean
Whether the class requires permissions in order to be professed intovoid
load
(studio.magemonkey.codex.mccore.config.parse.DataSection config) Loads class template data from the configurationboolean
receivesExp
(ExpSource source) Checks whether the class receives experience from the given sourcevoid
void
save
(studio.magemonkey.codex.mccore.config.parse.DataSection config) Saves the class template data to the configvoid
setActionBarText
(String text) void
setAllowedExpSources
(ExpSource... sources) Sets the experience sources this class can receive experience from.void
setManaName
(String name) Sets the mana alias for the classvoid
setManaRegen
(double amount) Sets the amount of mana regen this class hasvoid
Sets the prefix for the classvoid
softSave
(studio.magemonkey.codex.mccore.config.parse.DataSection config) Saves some of the class template data to the config, avoiding overwriting any existing data.
-
Field Details
-
settings
The settings for your class. This will include the health and mana scaling for the class. -
needsPermission
protected boolean needsPermissionWhether the class requires permissions in order to be professed into -
actionBar
-
-
Constructor Details
-
FabledClass
Initializes a class template that does not profess from other classes but is rather a starting class.- Parameters:
name
- name of the classicon
- icon representing the class in menusmaxLevel
- max level the class can reach
-
FabledClass
protected FabledClass(String name, org.bukkit.inventory.ItemStack icon, int maxLevel, String parent) Initializes a class template that can profess from the parent class when that class reaches its max level.- Parameters:
name
- name of the classicon
- icon representing the class in menusmaxLevel
- max level the class can reachparent
- parent class to profess from
-
FabledClass
protected FabledClass(String name, org.bukkit.inventory.ItemStack icon, int maxLevel, String group, String parent) Initializes a class template that can profess from the parent class when that class reaches its max level. The group is the category for the class which determines which classes can be professed into simultaneously. Classes in the same group will not be able to both be professed into at the same time while classes in different groups are able to. For example, a class "Warrior" in the "class" group and an "Elf" class in the "race" group can both be professed as by a player at the same time, giving the player the stats and skills from both.- Parameters:
name
- name of the classicon
- icon representing the class in menusmaxLevel
- max level the class can reachgroup
- class groupparent
- parent class to profess from
-
-
Method Details
-
getName
Retrieves the name of the class- Returns:
- class name
-
getPrefix
Retrieves the prefix of the class- Returns:
- class prefix
-
setPrefix
Sets the prefix for the class- Parameters:
prefix
- class prefix
-
getPrefixColor
public org.bukkit.ChatColor getPrefixColor()Retrieves the color of the class's prefix- Returns:
- prefix color
-
getSkillTree
Retrieves the skill tree representing the class skills- Returns:
- class skill tree
-
getGroup
Retrieves the group this class falls in- Returns:
- class group
-
getGroupSettings
Retrieves the settings for the class's group- Returns:
- settings for the class's group
-
hasParent
public boolean hasParent()Checks whether the class professes from another class- Returns:
- true if professes from another class, false otherwise
-
getParent
Retrieves the parent of this class- Returns:
- parent of the class or null if none
-
getRoot
-
getIcon
public org.bukkit.inventory.ItemStack getIcon()Retrieves the icon representing this class for menus- Returns:
- icon representation of the class
-
getSkillMap
- Returns:
- map of skills for use in menus
-
getIcon
Retrieves the icon representing this class for menus- Specified by:
getIcon
in interfaceIconHolder
- Parameters:
data
- player to get the icon for- Returns:
- icon representation of the class
-
isAllowed
public boolean isAllowed(org.bukkit.entity.Player player) - Specified by:
isAllowed
in interfaceIconHolder
-
getToolIcon
public org.bukkit.inventory.ItemStack getToolIcon()Gets the indicator for the class for the GUI tools- Returns:
- GUI tool indicator
-
getActionBarText
- Returns:
- text to display in the action bar for the class (nullable)
-
setActionBarText
-
hasActionBarText
public boolean hasActionBarText() -
receivesExp
Checks whether the class receives experience from the given source- Parameters:
source
- source of experience to check- Returns:
- true if receives experience from the source, false otherwise
-
getMaxLevel
public int getMaxLevel()Retrieves the max level in which this class can reach- Returns:
- max level this class can reach
-
getRequiredExp
public int getRequiredExp(int level) Retrieves the required amount of experience this class need to level- Parameters:
level
- current level of the class- Returns:
- required amount of experience to reach the next level
-
getHealth
public double getHealth(int level) Retrieves the amount of max health this class provides- Parameters:
level
- current level of the class- Returns:
- amount of max health the class provides
-
getBaseHealth
public double getBaseHealth()Retrieves the base amount of health for the class- Returns:
- base amount of health for the class
-
getHealthScale
public double getHealthScale()Retrieves the amount of health gained per level for the class- Returns:
- health gained per level
-
getMana
public double getMana(int level) Retrieves the amount of max mana this class provides- Parameters:
level
- current level of the class- Returns:
- amount of max mana the class provides
-
getBaseMana
public double getBaseMana()Retrieves the base amount of mana for the class- Returns:
- base amount of mana for the class
-
getManaScale
public double getManaScale()Retrieves the amount of mana gained per level for the class- Returns:
- mana gained per level
-
getAttribute
Gets the class attribute amount for the given level- Parameters:
key
- attribute keylevel
- class level- Returns:
- attribute amount
-
getSettings
Retrieves the settings for the class in a read-only format- Returns:
- settings for the class in a read-only format
-
getManaName
Retrieves the alias for mana this class uses- Returns:
- mana alias for the class
-
setManaName
Sets the mana alias for the class- Parameters:
name
- mana alias
-
getSkills
Retrieves the list of skills this class provides a player- Returns:
- list of skills provided by the class
-
getSkills
Retrieves the list of skills this class provides a player- Parameters:
includeParent
- Whether to include the parent skills or not- Returns:
- list of skills provided by the class
-
hasManaRegen
public boolean hasManaRegen()Checks whether this class has mana regeneration- Returns:
- true if the class has mana regeneration, false otherwise
-
getManaRegen
public double getManaRegen()Retrieves the amount of mana regeneration this class has- Returns:
- mana regeneration per update or a non-positive number if no regeneration
-
setManaRegen
public void setManaRegen(double amount) Sets the amount of mana regen this class has- Parameters:
amount
- amount of mana regen
-
getOptions
Retrieves the list of child classes that the player has as options to profess into upon reaching max level.- Returns:
- list of child classes
-
canUse
public boolean canUse(org.bukkit.Material type) -
addSkill
Adds a skill to the class by name. This will not add it to the skill tree or to players who are already professed as the class.- Parameters:
name
- name of the skill
-
addSkills
Adds multiple skills to the class by name. This will not add it to the skill tree or to players who are already professed as the class.- Parameters:
names
- names of the skills
-
setAllowedExpSources
Sets the experience sources this class can receive experience from.- Parameters:
sources
- allowed sources of experience
-
allowExpSource
Adds an experience source to the list of allowed sources for the class.- Parameters:
source
- allowed source of experience
-
disallowExpSource
Removes an experience source from the list of allowed sources for the class.- Parameters:
source
- disallowed source of experience
-
save
public void save(studio.magemonkey.codex.mccore.config.parse.DataSection config) Saves the class template data to the config- Parameters:
config
- config to save to
-
softSave
public void softSave(studio.magemonkey.codex.mccore.config.parse.DataSection config) Saves some of the class template data to the config, avoiding overwriting any existing data.- Parameters:
config
- config to save to
-
load
public void load(studio.magemonkey.codex.mccore.config.parse.DataSection config) Loads class template data from the configuration- Parameters:
config
- config to load from
-
reloadSkillTree
public void reloadSkillTree() -
arrange
public void arrange()Arranges the skill tree for the class -
canStartCombo
-
isNeedsPermission
public boolean isNeedsPermission()Whether the class requires permissions in order to be professed into
-