Package wbs.utils.util.particles
Class WbsParticleEffect
java.lang.Object
wbs.utils.util.particles.WbsParticleEffect
- Direct Known Subclasses:
CustomParticleEffect,ElectricParticleEffect,LineParticleEffect,NormalParticleEffect,VelocityParticleEffect
Represents a particle effect in a specific pattern
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWbsParticleEffect(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory) Create this effect from a ConfigurationSection, logging errors in the given settings -
Method Summary
Modifier and TypeMethodDescriptionabstract WbsParticleEffectbuild()Generate the particle set based on current settings.final WbsParticleEffectbuildAndPlay(org.bukkit.Particle particle, org.bukkit.Location loc) Run and regenerate the point set based on new settings.static WbsParticleEffectbuildParticleEffect(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory) Build a particle effect from a config, and output errors to the settings fieldabstract WbsParticleEffectclone()protected WbsParticleEffectcloneInto(WbsParticleEffect cloned) protected ArrayList<org.bukkit.Location>filterChances(ArrayList<org.bukkit.Location> points) intGets the amount defined in setAmount().Gets the amount provider directly.booleangetForce()protected ArrayList<org.bukkit.Location>getLocations(org.bukkit.Location loc) abstract WbsParticleEffectplay(org.bukkit.Particle particle, org.bukkit.Location loc) Run the effect pattern at the given location with the given particle.abstract WbsParticleEffectplay(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.protected static doublerand(double max) protected voidRefresh all providers for this object.protected static org.bukkit.util.VectorscaleVector(org.bukkit.util.Vector original, double magnitude) setAmount(int amount) setAmount(NumProvider amount) setChance(double chance) Set the chance of a given point spawning a particle.setForce(boolean force) Set whether particles spawned should be forced to render for players at any distancesetOptions(Object options) static voidvoidwriteToConfig(org.bukkit.configuration.ConfigurationSection section, String path) Save this effect in a config that can be read bybuildParticleEffect(ConfigurationSection, WbsSettings, String)
-
Field Details
-
upVector
protected static org.bukkit.util.Vector upVector -
pl
-
chance
protected double chance -
amount
-
options
-
force
protected boolean force -
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 definedsettings- The settings to log errors againstdirectory- 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 fromsettings- The settings to log errors todirectory- The path to the section within the parent section for logging purpsoes
-
setPlugin
-
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
Run and regenerate the point set based on new settings.- Parameters:
particle- The particle type to useloc- The location at which to run the effect.- Returns:
- The same object.
- See Also:
-
play
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 useloc- 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 useloc- The location at which to run the effect.player- The only play who will see it- Returns:
- The same object.
-
filterChances
-
getLocations
-
scaleVector
protected static org.bukkit.util.Vector scaleVector(org.bukkit.util.Vector original, double magnitude) -
rand
protected static double rand(double max) -
clone
-
cloneInto
-
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
Gets the amount provider directly.- Returns:
- The amount provider
-
setAmount
- Parameters:
amount- The new amount- Returns:
- The same particle effect
-
setAmount
- Parameters:
amount- The new amount provider- Returns:
- The same particle effect
-
setOptions
- Parameters:
options- The particle specific options - different for redstone, falling dust etc- Returns:
- The same object.
-
setChance
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
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
Save this effect in a config that can be read bybuildParticleEffect(ConfigurationSection, WbsSettings, String)- Parameters:
section- The section to write topath- The field/path inside the given section
-