Class FabledAttribute

java.lang.Object
studio.magemonkey.fabled.manager.FabledAttribute
All Implemented Interfaces:
IconHolder

public class FabledAttribute extends Object implements IconHolder
A single attribute template
  • Constructor Summary

    Constructors
    Constructor
    Description
    FabledAttribute(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 Type
    Method
    Description
    int
    Retrieves the starting cost of the attribute upgrade.
    double
    Retrieves the raw additional cost of the attribute upgrade.
    org.bukkit.inventory.ItemStack
    Retrieves the icon for the attribute
    Retrieves the config key of the attribute
    int
    Retrieves the max amount the attribute can be raised to
    Retrieves the name for the attribute
    org.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 value
    double
    modifyStat(String key, double base, int amount)
    Modifies a stat value
    void
    setCostModifier(double costModifier)
    Retrieves the raw additional cost of the attribute upgrade.
    void
    setMax(int max)
    Sets the max level for the attribute

    Methods inherited from class java.lang.Object

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

    • FabledAttribute

      public FabledAttribute(studio.magemonkey.codex.mccore.config.parse.DataSection data, String key)
      Creates a new attribute, loading the settings from the given config data.
      Parameters:
      data - config data to load from
      key - the key the attribute was labeled under
  • Method Details

    • getName

      public String getName()
      Retrieves the name for the attribute
      Returns:
      name of the attribute
    • getIcon

      public org.bukkit.inventory.ItemStack getIcon(PlayerData data)
      Retrieves the icon for the attribute
      Specified by:
      getIcon in interface IconHolder
      Returns:
      icon of the attribute
    • isAllowed

      public boolean isAllowed(org.bukkit.entity.Player player)
      Specified by:
      isAllowed in interface IconHolder
    • getToolIcon

      public org.bukkit.inventory.ItemStack getToolIcon()
      Returns:
      icon for the attribute for use in the GUI editor
    • modify

      public double modify(EffectComponent component, String key, double value, int amount)
      Modifies a dynamic condition's value
      Parameters:
      component - component to modify for
      key - key of the value to modify
      value - base value
      amount - amount of attribute points
      Returns:
      modified value
    • modifyStat

      public double modifyStat(String key, double base, int amount)
      Modifies a stat value
      Parameters:
      key - key of the stat
      base - base value of the stat
      amount - amount of attribute points
      Returns:
      modified stat value
    • getKey

      public String 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.