Package de.marcely.bedwars.tools
Class VarParticle
java.lang.Object
de.marcely.bedwars.tools.VarParticle
- All Implemented Interfaces:
Cloneable
Easy solution for using VarParticles that are being supported on any version.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final VarParticleDoesn't actually play any particle.static final VarParticlePlays the "CLOUD" particle effect.static final VarParticlePlays the "EXPLOSION_HUGE" ("EXPLOSION_EMITTER" with 1.20.5+) particle effect.static final VarParticlePlays the "MOB_SPELL" particle effect with the colors R129 G133 B149.static final VarParticlePlays the "SMOKE" particle effect. -
Method Summary
Modifier and TypeMethodDescriptionclone()abstract intgetCount()Get the amount of particles that will be shown.abstract StringgetName()Returns the name of the name/particle.abstract floatDefines the random offset at the x-coordinate at which a particle may be spawned.abstract floatDefines the random offset at the y-coordinate at which a particle may be spawned.abstract floatDefines the random offset at the z-coordinate at which a particle may be spawned.abstract booleanReturns whetherEffectis being used.abstract booleanReturns whetherParticleis being used.static VarParticlenewDyedMobSpell(Color color) Constructs a new VarParticle that displays swirls as seen with potion effects.static VarParticlenewDyedParticle(Color color) Constructs a new VarParticle that displays a redstone dust at the given color.static VarParticlenewInstanceByName(String type) Looks up for a particle/effect by the given name and returns a new instance.static VarParticlenewRandomizedDyedSwirl(int count, double offset) Returns a new instance of VarParticle that persists of a random color.static VarParticleparse(ConfigurationSection config) Parses a given config.abstract voidPlays the particle globally at the given location.abstract voidPlays the particle for at the given location.abstract voidsetCount(int count) Set the amount of particles that will be shown.abstract voidsetOffset(float x, float y, float z) Set the random offset at which a particle may be spawned.protected booleantestPlayAsync(Location loc)
-
Field Details
-
NONE
Doesn't actually play any particle. Used as a placeholder. -
PARTICLE_SMOKE
Plays the "SMOKE" particle effect. -
PARTICLE_EXPLOSION_HUGE
Plays the "EXPLOSION_HUGE" ("EXPLOSION_EMITTER" with 1.20.5+) particle effect. -
PARTICLE_CLOUD
Plays the "CLOUD" particle effect. -
PARTICLE_POTION_INVISIBILITY
Plays the "MOB_SPELL" particle effect with the colors R129 G133 B149.
-
-
Method Details
-
play
Plays the particle globally at the given location.- Parameters:
loc- The loaction where it shall be played.
-
play
Plays the particle for at the given location.- Parameters:
loc- The loaction where it shall be played.player- The player who shall see it
-
getName
Returns the name of the name/particle.- Returns:
- The name of the particle
-
isInternallyEffect
public abstract boolean isInternallyEffect()Returns whetherEffectis being used.- Returns:
truewhen Bukkit's Effect API is being used
-
isInternallyParticle
public abstract boolean isInternallyParticle()Returns whetherParticleis being used.- Returns:
truewhen Bukkit's Particle API is being used
-
getOffsetX
public abstract float getOffsetX()Defines the random offset at the x-coordinate at which a particle may be spawned.- Returns:
- The defined x-offset
-
getOffsetY
public abstract float getOffsetY()Defines the random offset at the y-coordinate at which a particle may be spawned.- Returns:
- The defined y-offset
-
getOffsetZ
public abstract float getOffsetZ()Defines the random offset at the z-coordinate at which a particle may be spawned.- Returns:
- The defined z-offset
-
setOffset
public abstract void setOffset(float x, float y, float z) Set the random offset at which a particle may be spawned.- Parameters:
x- Max radius for the x-coordinatey- Max radius for the y-coordinatez- Max radius for the z-coordinate
-
getCount
public abstract int getCount()Get the amount of particles that will be shown.- Returns:
- The amount of particles
-
setCount
public abstract void setCount(int count) Set the amount of particles that will be shown.- Parameters:
count- The new amount of particles
-
testPlayAsync
-
clone
-
parse
Parses a given config.Goes through all existing particles and effects within Bukkit. It's possible that the data vary between the versions.
It'll read the following fields:
- type (string, the name of the particle/effect)
- count (int)
- offset-x (double)
- offset-y (double)
- offset-z (double)
- extra (double)
- data (depends on the type)
When parsing a particle (1.9+) then there are the following possible types for the data:
- DustOptions: <red>,<blue>,<green>:<size>
- ItemStack: <itemstack in mbedwars format>
- BlockData: <material>
- MaterialData: <material>[:data]
- Parameters:
config- The config that shall be parsed- Returns:
- The parsed VarParticle instance that's ready to be played
- Throws:
IllegalArgumentException- If an error occured while parsing
-
newDyedParticle
Constructs a new VarParticle that displays a redstone dust at the given color.- Parameters:
color- The color of the redstone dust- Returns:
- A new instance with that color
-
newDyedMobSpell
Constructs a new VarParticle that displays swirls as seen with potion effects.- Parameters:
color- The color of the swirl particle- Returns:
- A new instance with that color
-
newRandomizedDyedSwirl
Returns a new instance of VarParticle that persists of a random color.Uses the particle
POTION_SWIRLon 1.12 or older. UsesREDSTONEon 1.13+- Parameters:
count- The amount of particlesoffset- The offset of particles- Returns:
- A newly constructed instance with a random color
- See Also:
-
newInstanceByName
Looks up for a particle/effect by the given name and returns a new instance.- Parameters:
type- The name- Returns:
- A new VarParticle instance with the given type
- Throws:
IllegalArgumentException- When the given name is invalid
-