Class Effect

java.lang.Object
de.slikey.effectlib.Effect
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
AnimatedBallEffect, ArcEffect, AtomEffect, BaseImageEffect, BigBangEffect, BleedEffect, CircleEffect, CloudEffect, ConeEffect, CubeEffect, CuboidEffect, CylinderEffect, DiscoBallEffect, DnaEffect, DonutEffect, DragonEffect, EarthEffect, EquationEffect, ExplodeEffect, FlameEffect, FountainEffect, GridEffect, HeartEffect, HelixEffect, HillEffect, IconEffect, JumpEffect, LineEffect, LoveEffect, ModifiedEffect, MusicEffect, ParticleEffect, PlotEffect, PyramidEffect, ShieldEffect, SmokeEffect, SoundEffect, SphereEffect, SquareEffect, StarEffect, TextEffect, TornadoEffect, TraceEffect, TurnEffect, VortexEffect, WarpEffect, WaveEffect

public abstract class Effect extends Object implements Runnable
  • Field Details

    • effectManager

      protected final EffectManager effectManager
    • subEffectClass

      protected String subEffectClass
    • origin

      protected DynamicLocation origin
    • target

      protected DynamicLocation target
    • maxIterations

      protected int maxIterations
    • type

      public EffectType type
    • particle

      public org.bukkit.Particle particle
    • color

      public org.bukkit.Color color
    • colorList

      public List<org.bukkit.Color> colorList
    • colors

      public String colors
    • toColor

      public org.bukkit.Color toColor
    • toColorList

      public List<org.bukkit.Color> toColorList
    • toColors

      public String toColors
    • shriekDelay

      public int shriekDelay
    • sculkChargeRotation

      public float sculkChargeRotation
    • arrivalTime

      public int arrivalTime
    • subEffect

      public org.bukkit.configuration.ConfigurationSection subEffect
    • speed

      public float speed
    • particleData

      public float particleData
    • delay

      public int delay
    • period

      public int period
    • iterations

      public int iterations
    • duration

      public Integer duration
    • probability

      public double probability
    • callback

      public Runnable callback
    • visibleRange

      public float visibleRange
    • autoOrient

      public boolean autoOrient
    • offset

      public org.bukkit.util.Vector offset
    • relativeOffset

      public org.bukkit.util.Vector relativeOffset
    • targetOffset

      public org.bukkit.util.Vector targetOffset
    • yawOffset

      public float yawOffset
    • pitchOffset

      public float pitchOffset
    • yaw

      public Float yaw
    • pitch

      public Float pitch
    • updateLocations

      public boolean updateLocations
    • updateDirections

      public boolean updateDirections
    • targetPlayers

      public List<org.bukkit.entity.Player> targetPlayers
    • material

      public org.bukkit.Material material
    • materialData

      public byte materialData
    • blockData

      public String blockData
    • blockDuration

      public long blockDuration
    • particleCount

      public int particleCount
    • particleOffsetX

      public float particleOffsetX
    • particleOffsetY

      public float particleOffsetY
    • particleOffsetZ

      public float particleOffsetZ
    • particleSize

      public float particleSize
    • asynchronous

      public boolean asynchronous
    • disappearWithOriginEntity

      public boolean disappearWithOriginEntity
    • disappearWithTargetEntity

      public boolean disappearWithTargetEntity
  • Constructor Details

  • Method Details

    • getEffectManager

      public EffectManager getEffectManager()
    • getType

      @Nonnull public EffectType getType()
      Type of effect being played.
      See Also:
    • getParticle

      @Nullable public org.bukkit.Particle getParticle()
      ParticleType of spawned particle.
    • getColor

      @Nullable public org.bukkit.Color getColor()
      Can be used to colorize certain particles. As of 1.8, those include SPELL_MOB_AMBIENT, SPELL_MOB and REDSTONE.
    • getColorList

      public List<org.bukkit.Color> getColorList()
    • getColors

      public String getColors()
    • getToColor

      @Nullable public org.bukkit.Color getToColor()
      Used for dust particles in 1.17 and up, to make a color transition.
    • getToColorList

      public List<org.bukkit.Color> getToColorList()
    • getToColors

      public String getToColors()
    • getShriekDelay

      public int getShriekDelay()
      Used only by the shriek particle in 1.19 and up.
    • getSculkChargeRotation

      public float getSculkChargeRotation()
      Used only by the sculk_charge particle in 1.19 and up.
    • getArrivalTime

      public int getArrivalTime()
      Used only by the vibration particle in 1.17 and up.
    • getSubEffectClass

      @Nullable public String getSubEffectClass()
      Class of subeffect to play at effect location.
    • getSubEffect

      @Nullable public org.bukkit.configuration.ConfigurationSection getSubEffect()
      Config section of subeffect to play at effect location.
    • getSpeed

      @Deprecated public float getSpeed()
      Deprecated.
      This can be used to give particles a set speed when spawned. This will not work with colored particles.
    • getParticleData

      public float getParticleData()
      This can be used to give particles a set speed when spawned. This will not work with colored particles. This is a replacement for "speed"
    • getDelay

      public int getDelay()
      Interval to wait for repeating effects.
      See Also:
    • getPeriod

      public int getPeriod()
      Amount of repetitions to do. Set this to -1 for an infinite effect
      See Also:
    • getIterations

      public int getIterations()
      Amount of repetitions to do. Set this to -1 for an infinite effect
      See Also:
    • getDuration

      public Integer getDuration()
      Total duration of this effect in milliseconds. If set, this will adjust iterations to match the defined delay such that the effect lasts a specific duration.
    • getProbability

      public double getProbability()
      Probability that this effect will play on each iteration.
    • getCallback

      public Runnable getCallback()
      Callback to run, after effect is done.
      See Also:
    • getVisibleRange

      public float getVisibleRange()
      Display particles to players within this radius.
    • isAutoOrient

      public boolean isAutoOrient()
      If true, and a "target" Location or Entity is set, the two Locations will orient to face one another.
    • getOffset

      public org.bukkit.util.Vector getOffset()
      If set, will offset the origin location.
    • getRelativeOffset

      public org.bukkit.util.Vector getRelativeOffset()
      If set, will offset the origin location, relative to the origin direction.
    • getTargetOffset

      public org.bukkit.util.Vector getTargetOffset()
      If set, will offset the target location.
    • getYawOffset

      public float getYawOffset()
      These are used to modify the direction of the origin Location.
    • getPitchOffset

      public float getPitchOffset()
    • getYaw

      public Float getYaw()
    • getPitch

      public Float getPitch()
    • isUpdateLocations

      public boolean isUpdateLocations()
      If set to false, Entity-bound locations will not update during the Effect
    • canUpdateDirections

      public boolean canUpdateDirections()
      If set to false, Entity-bound directions will not update during the Effect
    • getTargetPlayer

      public org.bukkit.entity.Player getTargetPlayer()
      A specific player who should see this effect.
    • setTargetPlayer

      public void setTargetPlayer(org.bukkit.entity.Player targetPlayer)
    • getTargetPlayers

      public List<org.bukkit.entity.Player> getTargetPlayers()
      A group of players who should see this effect.
    • setTargetPlayers

      public void setTargetPlayers(List<org.bukkit.entity.Player> targetPlayers)
    • getMaterial

      public org.bukkit.Material getMaterial()
      The Material and data to use for block and item break particles
    • setMaterial

      public void setMaterial(org.bukkit.Material material)
    • setType

      public void setType(EffectType type)
    • getMaterialData

      public byte getMaterialData()
    • setMaterialData

      public void setMaterialData(byte materialData)
    • getBlockData

      public String getBlockData()
    • setBlockData

      public void setBlockData(String blockData)
    • getBlockDuration

      public long getBlockDuration()
    • setBlockDuration

      public void setBlockDuration(long blockDuration)
    • getParticleCount

      public int getParticleCount()
    • setParticleCount

      public void setParticleCount(int particleCount)
    • getParticleOffsetX

      public float getParticleOffsetX()
    • setParticleOffsetX

      public void setParticleOffsetX(float particleOffsetX)
    • getParticleOffsetY

      public float getParticleOffsetY()
    • setParticleOffsetY

      public void setParticleOffsetY(float particleOffsetY)
    • getParticleOffsetZ

      public float getParticleOffsetZ()
    • setParticleOffsetZ

      public void setParticleOffsetZ(float particleOffsetZ)
    • getParticleSize

      public float getParticleSize()
      Used to scale up or down a particle's size. This currently only works with the REDSTONE particle in 1.13 and up.
    • setParticleSize

      public void setParticleSize(float particleSize)
    • isAsynchronous

      public boolean isAsynchronous()
      If set, will run asynchronously. Some effects don't support this (TurnEffect, JumpEffect) Generally this shouldn't be changed, unless you want to make an async effect synchronous.
    • getEntity

      public org.bukkit.entity.Entity getEntity()
      Extending Effect classes can use this to determine the Entity this Effect is centered upon. This may return null, even for an Effect that was set with an Entity, if the Entity gets GC'd.
    • setEntity

      public void setEntity(org.bukkit.entity.Entity entity)
    • getTargetEntity

      public org.bukkit.entity.Entity getTargetEntity()
      Extending Effect classes can use this to determine the Entity this Effect is targeted upon. This is probably a very rare case, such as an Effect that "links" two Entities together somehow. (Idea!) This may return null, even for an Effect that was set with a target Entity, if the Entity gets GC'd.
    • setTargetEntity

      public void setTargetEntity(org.bukkit.entity.Entity entity)
    • getLocation

      public final org.bukkit.Location getLocation()
      Extending Effect classes should use this method to obtain the current "root" Location of the effect. This method will not return null when called from onRun. Effects with invalid locations will be cancelled.
    • setLocation

      public void setLocation(org.bukkit.Location location)
    • getTarget

      public final org.bukkit.Location getTarget()
      Extending Effect classes should use this method to obtain the current "target" Location of the effect. Unlike getLocation, this may return null.
    • setTarget

      public void setTarget(org.bukkit.Location location)
    • setTargetLocation

      public void setTargetLocation(org.bukkit.Location location)
      Deprecated.
    • getDynamicOrigin

      public DynamicLocation getDynamicOrigin()
    • setDynamicOrigin

      public void setDynamicOrigin(DynamicLocation location)
      Set the Location this Effect is centered on.
    • getDynamicTarget

      public DynamicLocation getDynamicTarget()
    • setDynamicTarget

      public void setDynamicTarget(DynamicLocation location)
      Set the Location this Effect is targeting.
    • getOrigin

      public DynamicLocation getOrigin()
    • setOrigin

      public void setOrigin(DynamicLocation origin)
    • getMaxIterations

      public int getMaxIterations()
      This will store the base number of iterations
    • setMaxIterations

      public void setMaxIterations(int maxIterations)
    • canDisappearWithOriginEntity

      public boolean canDisappearWithOriginEntity()
      Should this effect stop playing if the origin entity becomes invalid?
    • canDisappearWithTargetEntity

      public boolean canDisappearWithTargetEntity()
      Should this effect stop playing if the target entity becomes invalid?
    • isDone

      public final boolean isDone()
    • isPlaying

      public boolean isPlaying()
    • getStartTime

      public long getStartTime()
    • setStartTime

      public void setStartTime(long startTime)
    • parseColorList

      protected List<org.bukkit.Color> parseColorList(String colors)
    • initialize

      protected void initialize()
    • cancel

      public final void cancel()
    • cancel

      public final void cancel(boolean callback)
    • onRun

      public abstract void onRun()
    • onDone

      public void onDone()
      Called when this effect is done playing (when done() is called).
    • run

      public final void run()
      Specified by:
      run in interface Runnable
    • reset

      protected void reset()
      Effects should override this if they want to be reusable, this is called prior to starting so state can be reset.
    • prepare

      public void prepare()
    • start

      public final void start()
    • infinite

      public final void infinite()
    • validate

      protected final boolean validate()
    • updateDuration

      protected void updateDuration()
    • updateLocation

      protected void updateLocation()
    • updateTarget

      protected void updateTarget()
    • display

      protected void display(org.bukkit.Particle effect, org.bukkit.Location location)
    • display

      protected void display(org.bukkit.Particle particle, org.bukkit.Location location, org.bukkit.Color color)
    • display

      protected void display(org.bukkit.Particle particle, org.bukkit.Location location, float speed, int amount)
    • display

      protected void display(org.bukkit.Particle particle, org.bukkit.Location location, org.bukkit.Color color, float speed, int amount)
    • display

      protected void display(org.bukkit.Particle particle, org.bukkit.Location location, org.bukkit.Color color, org.bukkit.Color toColor, float speed, int amount)
    • reloadParameters

      public void reloadParameters()