java.lang.Object
me.deecaad.core.mechanics.defaultmechanics.Mechanic
All Implemented Interfaces:
InlineSerializer<Mechanic>, Serializer<Mechanic>, net.kyori.adventure.key.Keyed, org.bukkit.Keyed
Direct Known Subclasses:
ActionBarMechanic, ActivateBlockMechanic, BossBarMechanic, CommandMechanic, DamageMechanic, DropItemMechanic, IgniteMechanic, LeapMechanic, LightningMechanic, MessageMechanic, PlayerEffectMechanic, PlayerEffectMechanicList, PotionMechanic, PushMechanic, TitleMechanic

public abstract class Mechanic extends Object implements InlineSerializer<Mechanic>
A Mechanic is the most powerful tool available to server-admins through config. A Mechanic is an action, basically a block of code, that the admin writes in YAML format. These actions can be executed conditionally using Condition and can get specifically targeted using Targeter.
  • Field Details

  • Constructor Details

    • Mechanic

      public Mechanic()
      Default constructor for serializer.
  • Method Details

    • getTargeter

      public Targeter getTargeter()
    • getConditions

      public List<Condition> getConditions()
    • getRepeatAmount

      public int getRepeatAmount()
    • getRepeatInterval

      public int getRepeatInterval()
    • getDelayBeforePlay

      public int getDelayBeforePlay()
    • getChance

      public double getChance()
    • use

      public void use(CastData cast)
      This method will trigger this Mechanic.

      This method probably shouldn't be overridden. It handles the global repeat, delay, targeter, and condition code. The behavior of the specific Mechanic is handled by the protected use0(CastData) method.

      Parameters:
      cast - The non-null cast data.
    • handleTargetersAndConditions

      protected void handleTargetersAndConditions(CastData cast)
    • use0

      protected abstract void use0(CastData cast)
      This method should be overridden to define the behavior of the Mechanic. For example, a Potion mechanic may use the CastData.getTarget() method to apply a potion effect.
      Parameters:
      cast - The non-null data including source/target information.
    • applyParentArgs

      public Mechanic applyParentArgs(me.deecaad.core.file.SerializeData data, Mechanic mechanic) throws me.deecaad.core.file.SerializerException
      Throws:
      me.deecaad.core.file.SerializerException