Class EffectComponent

java.lang.Object
com.sucy.skill.dynamic.EffectComponent
Direct Known Subclasses:
ConditionComponent, CustomEffectComponent, MechanicComponent, TargetComponent, TriggerComponent

public abstract class EffectComponent extends Object
A component for dynamic skills which takes care of one effect
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Child components
    boolean
    Whether the component has preview effects
    protected PreviewType
    Type of indicators to show
    protected final Settings
    The settings for the component
    protected DynamicSkill
    Parent class of the component
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cleanUp(org.bukkit.entity.LivingEntity caster)
     
    protected void
    doCleanUp(org.bukkit.entity.LivingEntity caster)
     
    boolean
    execute(org.bukkit.entity.LivingEntity caster, int level, List<org.bukkit.entity.LivingEntity> targets)
     
    abstract boolean
    execute(org.bukkit.entity.LivingEntity caster, int level, List<org.bukkit.entity.LivingEntity> targets, boolean force)
    Executes the component (to be implemented)
    protected boolean
    executeChildren(org.bukkit.entity.LivingEntity caster, int level, List<org.bukkit.entity.LivingEntity> targets, boolean force)
    Executes the children of the component using the given targets
    protected String
    filter(org.bukkit.entity.LivingEntity caster, org.bukkit.entity.LivingEntity target, String text)
     
    Retrieves the config key for the component
    abstract String
     
    protected double
    getNum(org.bukkit.entity.LivingEntity caster, String key, double fallback)
    Retrieves a numerical value while using non-numerical values as keys for the cast data.
    Retrieves the settings of the dynamic component
    protected PlayerSkill
    getSkillData(org.bukkit.entity.LivingEntity caster)
    Gets the skill data for the caster
    abstract ComponentType
    Retrieves the type of the component
    boolean
    Whether the component or its children have a preview effect
    protected boolean
    Checks whether the last component passed or not
    void
    load(DynamicSkill skill, mc.promcteam.engine.mccore.config.parse.DataSection config)
    Loads component data from the configuration
    protected double
    parseValues(org.bukkit.entity.LivingEntity caster, String key, int level, double fallback)
    Retrieves an attribute value while applying attribute data if enabled and a player is using the skill
    void
    playPreview(org.bukkit.entity.Player caster, int level, List<org.bukkit.entity.LivingEntity> targets, int step)
    Creates the list of indicators for the skill
    void
    save(mc.promcteam.engine.mccore.config.parse.DataSection config)
    Saves the component and its children to the config

    Methods inherited from class java.lang.Object

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

    • children

      public final ArrayList<EffectComponent> children
      Child components
    • settings

      protected final Settings settings
      The settings for the component
    • hasPreview

      public boolean hasPreview
      Whether the component has preview effects
    • skill

      protected DynamicSkill skill
      Parent class of the component
    • previewType

      protected PreviewType previewType
      Type of indicators to show
  • Constructor Details

    • EffectComponent

      public EffectComponent()
  • Method Details

    • getInstanceKey

      public String getInstanceKey()
      Retrieves the config key for the component
      Returns:
      config key of the component
    • getKey

      public abstract String getKey()
    • getType

      public abstract ComponentType getType()
      Retrieves the type of the component
      Returns:
      component type
    • getSettings

      public Settings getSettings()
      Retrieves the settings of the dynamic component
      Returns:
      settings of the dynamic component
    • hasPreview

      public boolean hasPreview()
      Whether the component or its children have a preview effect
      Returns:
      true if has a preview, false otherwise
    • parseValues

      protected double parseValues(org.bukkit.entity.LivingEntity caster, String key, int level, double fallback)
      Retrieves an attribute value while applying attribute data if enabled and a player is using the skill
      Parameters:
      caster - caster of the skill
      key - key of the value to grab
      level - level of the skill
      fallback - default value for the attribute
      Returns:
      the value with attribute modifications if applicable
    • getNum

      protected double getNum(org.bukkit.entity.LivingEntity caster, String key, double fallback)
      Retrieves a numerical value while using non-numerical values as keys for the cast data. If the value doesn't exist, this will return the default value. If it is a key that doesn't have an attached value, it will return 0. Otherwise, it will return the appropriate value.
      Parameters:
      caster - the caster of the skill
      key - key of the value
      fallback - fallback value in case the settings don't have it
      Returns:
      the settings value or, if not a number, the cast data value
    • lastPassed

      protected boolean lastPassed()
      Checks whether the last component passed or not
      Returns:
      true if passed, false otherwise
    • executeChildren

      protected boolean executeChildren(org.bukkit.entity.LivingEntity caster, int level, List<org.bukkit.entity.LivingEntity> targets, boolean force)
      Executes the children of the component using the given targets
      Parameters:
      caster - caster of the skill
      level - level of the skill
      targets - targets to execute on
      force -
      Returns:
      true if executed, false if conditions not met
    • cleanUp

      public void cleanUp(org.bukkit.entity.LivingEntity caster)
    • doCleanUp

      protected void doCleanUp(org.bukkit.entity.LivingEntity caster)
    • getSkillData

      protected PlayerSkill getSkillData(org.bukkit.entity.LivingEntity caster)
      Gets the skill data for the caster
      Parameters:
      caster - caster of the skill
      Returns:
      skill data for the caster or null if not found
    • filter

      protected String filter(org.bukkit.entity.LivingEntity caster, org.bukkit.entity.LivingEntity target, String text)
    • execute

      public boolean execute(org.bukkit.entity.LivingEntity caster, int level, List<org.bukkit.entity.LivingEntity> targets)
    • execute

      public abstract boolean execute(org.bukkit.entity.LivingEntity caster, int level, List<org.bukkit.entity.LivingEntity> targets, boolean force)
      Executes the component (to be implemented)
      Parameters:
      caster - caster of the skill
      level - level of the skill
      targets - targets to execute on
      force - whether skill should be forced
      Returns:
      true if executed, false if conditions not met
    • playPreview

      public void playPreview(org.bukkit.entity.Player caster, int level, List<org.bukkit.entity.LivingEntity> targets, int step)
      Creates the list of indicators for the skill
      Parameters:
      caster - caster reference
      targets - location to base location on
      level - the level of the skill to create for
      step - the current progress of the indicator
    • save

      public void save(mc.promcteam.engine.mccore.config.parse.DataSection config)
      Saves the component and its children to the config
      Parameters:
      config - config to save to
    • load

      public void load(DynamicSkill skill, mc.promcteam.engine.mccore.config.parse.DataSection config)
      Loads component data from the configuration
      Parameters:
      skill - owning skill of the component
      config - config data to load from