Class WbsParticleEffect

java.lang.Object
wbs.utils.util.particles.WbsParticleEffect
Direct Known Subclasses:
CustomParticleEffect, ElectricParticleEffect, LineParticleEffect, NormalParticleEffect, VelocityParticleEffect

public abstract class WbsParticleEffect extends Object
Represents a particle effect in a specific pattern
  • Field Details

    • upVector

      protected static org.bukkit.util.Vector upVector
    • pl

      protected static WbsUtils pl
    • chance

      protected double chance
    • amount

      protected NumProvider amount
    • options

      protected Object options
    • force

      protected boolean force
    • points

      protected final ArrayList<org.bukkit.util.Vector> points
  • Constructor Details

    • WbsParticleEffect

      public WbsParticleEffect()
    • WbsParticleEffect

      protected WbsParticleEffect(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory)
      Create this effect from a ConfigurationSection, logging errors in the given settings
      Parameters:
      section - The section where this effect is defined
      settings - The settings to log errors against
      directory - The path taken through the config to get to this point, for logging purposes
  • Method Details

    • buildParticleEffect

      public static WbsParticleEffect buildParticleEffect(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory)
      Build a particle effect from a config, and output errors to the settings field
      Parameters:
      section - The configuration section to build from
      settings - The settings to log errors to
      directory - The path to the section within the parent section for logging purpsoes
    • setPlugin

      public static void setPlugin(WbsUtils plugin)
    • build

      public abstract WbsParticleEffect build()
      Generate the particle set based on current settings. Call this before the first time it is run, or call buildAndRun each time to run based on current settings.
      Returns:
      The same object.
    • refreshProviders

      protected void refreshProviders()
      Refresh all providers for this object. Subclasses may override this, but should call super.refreshProviders() at the start of the method
    • buildAndPlay

      public final WbsParticleEffect buildAndPlay(org.bukkit.Particle particle, org.bukkit.Location loc)
      Run and regenerate the point set based on new settings.
      Parameters:
      particle - The particle type to use
      loc - The location at which to run the effect.
      Returns:
      The same object.
      See Also:
    • play

      public abstract WbsParticleEffect play(org.bukkit.Particle particle, org.bukkit.Location loc)
      Run the effect pattern at the given location with the given particle. For shapes needing two locations (such as Line), a random second location will be chosen a random number of blocks away from the given location.
      Parameters:
      particle - The particle type to use
      loc - The location at which to run the effect.
      Returns:
      The same object.
    • play

      public abstract WbsParticleEffect play(org.bukkit.Particle particle, org.bukkit.Location loc, org.bukkit.entity.Player player)
      Run the effect pattern at the given location with the given particle. For shapes needing two locations (such as Line), a random second location will be chosen a random number of blocks away from the given location.
      Parameters:
      particle - The particle type to use
      loc - The location at which to run the effect.
      player - The only play who will see it
      Returns:
      The same object.
    • filterChances

      protected ArrayList<org.bukkit.Location> filterChances(ArrayList<org.bukkit.Location> points)
    • getLocations

      protected ArrayList<org.bukkit.Location> getLocations(org.bukkit.Location loc)
    • scaleVector

      protected static org.bukkit.util.Vector scaleVector(org.bukkit.util.Vector original, double magnitude)
    • rand

      protected static double rand(double max)
    • clone

      public abstract WbsParticleEffect clone()
      Overrides:
      clone in class Object
    • cloneInto

      protected WbsParticleEffect cloneInto(WbsParticleEffect cloned)
    • getAmount

      public int getAmount()
      Gets the amount defined in setAmount(). Note that, while in many shapes this will be the amount of particles spawn, it's not always the case.
      Returns:
      The amount
    • getAmountProvider

      public NumProvider getAmountProvider()
      Gets the amount provider directly.
      Returns:
      The amount provider
    • setAmount

      public WbsParticleEffect setAmount(int amount)
      Parameters:
      amount - The new amount
      Returns:
      The same particle effect
    • setAmount

      public WbsParticleEffect setAmount(NumProvider amount)
      Parameters:
      amount - The new amount provider
      Returns:
      The same particle effect
    • setOptions

      public WbsParticleEffect setOptions(Object options)
      Parameters:
      options - The particle specific options - different for redstone, falling dust etc
      Returns:
      The same object.
    • setChance

      public WbsParticleEffect setChance(double chance)
      Set the chance of a given point spawning a particle. Will not affect the NORMAL effect type
      Parameters:
      chance - The chance of a given point to spawn
      Returns:
      The same particle effect
    • setForce

      public WbsParticleEffect setForce(boolean force)
      Set whether particles spawned should be forced to render for players at any distance
      Parameters:
      force - Whether or not to force rendering
      Returns:
      The same particle effect
    • getForce

      public boolean getForce()
      Returns:
      Whether or not to force rendering for players at any distance
    • writeToConfig

      public void writeToConfig(org.bukkit.configuration.ConfigurationSection section, String path)
      Save this effect in a config that can be read by buildParticleEffect(ConfigurationSection, WbsSettings, String)
      Parameters:
      section - The section to write to
      path - The field/path inside the given section