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
Modifier and TypeFieldDescriptionstatic final VarParticle
Doesn't actually play any particle.static final VarParticle
Plays the "CLOUD" particle effect.static final VarParticle
Plays the "EXPLOSION_HUGE" ("EXPLOSION_EMITTER" with 1.20.5+) particle effect.static final VarParticle
Plays the "MOB_SPELL" particle effect with the colors R129 G133 B149.static final VarParticle
Plays the "SMOKE" particle effect. -
Method Summary
Modifier and TypeMethodDescriptionclone()
abstract int
getCount()
Get the amount of particles that will be shown.abstract String
getName()
Returns the name of the name/particle.abstract float
Defines the random offset at the x-coordinate at which a particle may be spawned.abstract float
Defines the random offset at the y-coordinate at which a particle may be spawned.abstract float
Defines the random offset at the z-coordinate at which a particle may be spawned.abstract boolean
Returns whetherEffect
is being used.abstract boolean
Returns whetherParticle
is being used.static VarParticle
newDyedMobSpell
(Color color) Constructs a new VarParticle that displays swirls as seen with potion effects.static VarParticle
newDyedParticle
(Color color) Constructs a new VarParticle that displays a redstone dust at the given color.static VarParticle
newInstanceByName
(String type) Looks up for a particle/effect by the given name and returns a new instance.static VarParticle
newRandomizedDyedSwirl
(int count, double offset) Returns a new instance of VarParticle that persists of a random color.static VarParticle
parse
(ConfigurationSection config) Parses a given config.abstract void
Plays the particle globally at the given location.abstract void
Plays the particle for at the given location.abstract void
setCount
(int count) Set the amount of particles that will be shown.abstract void
setOffset
(float x, float y, float z) Set the random offset at which a particle may be spawned.protected boolean
testPlayAsync
(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 whetherEffect
is being used.- Returns:
true
when Bukkit's Effect API is being used
-
isInternallyParticle
public abstract boolean isInternallyParticle()Returns whetherParticle
is being used.- Returns:
true
when 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_SWIRL
on 1.12 or older. UsesREDSTONE
on 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
-