Class FabledClass

java.lang.Object
studio.magemonkey.fabled.api.classes.FabledClass
All Implemented Interfaces:
IconHolder
Direct Known Subclasses:
DynamicClass

public abstract class FabledClass extends Object implements IconHolder
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
    Modifier and Type
    Field
    Description
    protected String
     
    protected boolean
    Whether the class requires permissions in order to be professed into
    protected final Settings
    The settings for your class.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    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 Type
    Method
    Description
    void
    Adds a skill to the class by name.
    void
    addSkills(String... names)
    Adds multiple skills to the class by name.
    void
    Adds an experience source to the list of allowed sources for the class.
    void
    Arranges the skill tree for the class
    boolean
    canStartCombo(Click click, org.bukkit.inventory.ItemStack itemStack)
     
    boolean
    canUse(org.bukkit.Material type)
     
    void
    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 level
    double
    Retrieves the base amount of health for the class
    double
    Retrieves the base amount of mana for the class
    Retrieves the group this class falls in
    Retrieves the settings for the class's group
    double
    getHealth(int level)
    Retrieves the amount of max health this class provides
    double
    Retrieves the amount of health gained per level for the class
    org.bukkit.inventory.ItemStack
    Retrieves the icon representing this class for menus
    org.bukkit.inventory.ItemStack
    Retrieves the icon representing this class for menus
    double
    getMana(int level)
    Retrieves the amount of max mana this class provides
    Retrieves the alias for mana this class uses
    double
    Retrieves the amount of mana regeneration this class has
    double
    Retrieves the amount of mana gained per level for the class
    int
    Retrieves the max level in which this class can reach
    Retrieves the name of the class
    Retrieves the list of child classes that the player has as options to profess into upon reaching max level.
    Retrieves the parent of this class
    Retrieves the prefix of the class
    org.bukkit.ChatColor
    Retrieves the color of the class's prefix
    int
    getRequiredExp(int level)
    Retrieves the required amount of experience this class need to level
     
    Retrieves the settings for the class in a read-only format
     
    Retrieves the list of skills this class provides a player
    getSkills(boolean includeParent)
    Retrieves the list of skills this class provides a player
    Retrieves the skill tree representing the class skills
    org.bukkit.inventory.ItemStack
    Gets the indicator for the class for the GUI tools
    boolean
     
    boolean
    Checks whether this class has mana regeneration
    boolean
    Checks whether the class professes from another class
    boolean
    isAllowed(org.bukkit.entity.Player player)
     
    boolean
    Whether the class requires permissions in order to be professed into
    void
    load(studio.magemonkey.codex.mccore.config.parse.DataSection config)
    Loads class template data from the configuration
    boolean
    Checks whether the class receives experience from the given source
    void
     
    void
    save(studio.magemonkey.codex.mccore.config.parse.DataSection config)
    Saves the class template data to the config
    void
     
    void
    Sets the experience sources this class can receive experience from.
    void
    Sets the mana alias for the class
    void
    setManaRegen(double amount)
    Sets the amount of mana regen this class has
    void
    setPrefix(String prefix)
    Sets the prefix for the class
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • settings

      protected final Settings settings
      The settings for your class. This will include the health and mana scaling for the class.
    • needsPermission

      protected boolean needsPermission
      Whether the class requires permissions in order to be professed into
    • actionBar

      protected String actionBar
  • Constructor Details

    • FabledClass

      protected 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.
      Parameters:
      name - name of the class
      icon - icon representing the class in menus
      maxLevel - 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 class
      icon - icon representing the class in menus
      maxLevel - max level the class can reach
      parent - 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 class
      icon - icon representing the class in menus
      maxLevel - max level the class can reach
      group - class group
      parent - parent class to profess from
  • Method Details

    • getName

      public String getName()
      Retrieves the name of the class
      Returns:
      class name
    • getPrefix

      public String getPrefix()
      Retrieves the prefix of the class
      Returns:
      class prefix
    • setPrefix

      public void setPrefix(String prefix)
      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

      public InventoryTree getSkillTree()
      Retrieves the skill tree representing the class skills
      Returns:
      class skill tree
    • getGroup

      public String getGroup()
      Retrieves the group this class falls in
      Returns:
      class group
    • getGroupSettings

      public GroupSettings 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

      public FabledClass getParent()
      Retrieves the parent of this class
      Returns:
      parent of the class or null if none
    • getRoot

      public FabledClass getRoot()
    • getIcon

      public org.bukkit.inventory.ItemStack getIcon()
      Retrieves the icon representing this class for menus
      Returns:
      icon representation of the class
    • getSkillMap

      public Map<String,Skill> getSkillMap()
      Returns:
      map of skills for use in menus
    • getIcon

      public org.bukkit.inventory.ItemStack getIcon(PlayerData data)
      Retrieves the icon representing this class for menus
      Specified by:
      getIcon in interface IconHolder
      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 interface IconHolder
    • getToolIcon

      public org.bukkit.inventory.ItemStack getToolIcon()
      Gets the indicator for the class for the GUI tools
      Returns:
      GUI tool indicator
    • getActionBarText

      public String getActionBarText()
      Returns:
      text to display in the action bar for the class (nullable)
    • setActionBarText

      public void setActionBarText(String text)
    • hasActionBarText

      public boolean hasActionBarText()
    • receivesExp

      public boolean receivesExp(ExpSource source)
      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

      public int getAttribute(String key, int level)
      Gets the class attribute amount for the given level
      Parameters:
      key - attribute key
      level - class level
      Returns:
      attribute amount
    • getSettings

      public ReadOnlySettings getSettings()
      Retrieves the settings for the class in a read-only format
      Returns:
      settings for the class in a read-only format
    • getManaName

      public String getManaName()
      Retrieves the alias for mana this class uses
      Returns:
      mana alias for the class
    • setManaName

      public void setManaName(String name)
      Sets the mana alias for the class
      Parameters:
      name - mana alias
    • getSkills

      public List<Skill> getSkills()
      Retrieves the list of skills this class provides a player
      Returns:
      list of skills provided by the class
    • getSkills

      public List<Skill> getSkills(boolean includeParent)
      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

      public ArrayList<FabledClass> 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

      public void addSkill(String name)
      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

      public void addSkills(String... names)
      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

      public void setAllowedExpSources(ExpSource... sources)
      Sets the experience sources this class can receive experience from.
      Parameters:
      sources - allowed sources of experience
    • allowExpSource

      public void allowExpSource(ExpSource source)
      Adds an experience source to the list of allowed sources for the class.
      Parameters:
      source - allowed source of experience
    • disallowExpSource

      public void disallowExpSource(ExpSource source)
      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

      public boolean canStartCombo(Click click, @Nullable org.bukkit.inventory.ItemStack itemStack)
    • isNeedsPermission

      public boolean isNeedsPermission()
      Whether the class requires permissions in order to be professed into