public class ParticleBuilder extends Object
World.spawnParticle(Particle, Location, int, double, double, double, double, Object)
APIConstructor and Description |
---|
ParticleBuilder(@NotNull Particle particle) |
Modifier and Type | Method and Description |
---|---|
@NotNull ParticleBuilder |
allPlayers()
Sends this particle to all players in the world.
|
@NotNull ParticleBuilder |
color(@Nullable Color color)
Sets the particle Color.
|
@NotNull ParticleBuilder |
color(@Nullable Color color,
float size)
Sets the particle Color and size.
|
@NotNull ParticleBuilder |
color(int r,
int g,
int b)
Sets the particle Color.
|
int |
count() |
@NotNull ParticleBuilder |
count(int count)
Sets the number of particles to spawn
|
<T> T |
data()
Gets the particle custom data.
|
<T> @NotNull ParticleBuilder |
data(T data)
Sets the particle custom data.
|
double |
extra()
Gets the Particle extra data.
|
@NotNull ParticleBuilder |
extra(double extra)
Sets the particle extra data.
|
@NotNull ParticleBuilder |
force(boolean force)
Sets whether the particle is forcefully shown to the player.
|
boolean |
hasReceivers()
Example use:
builder.receivers(16); if (builder.hasReceivers()) { sendParticleAsync(builder); }
|
@Nullable Location |
location() |
@NotNull ParticleBuilder |
location(@NotNull Location location)
Sets the location of where to spawn the particle
|
@NotNull ParticleBuilder |
location(@NotNull World world,
double x,
double y,
double z)
Sets the location of where to spawn the particle
|
@NotNull ParticleBuilder |
offset(double offsetX,
double offsetY,
double offsetZ)
Sets the particle offset.
|
double |
offsetX()
Particle offset X.
|
double |
offsetY()
Particle offset Y.
|
double |
offsetZ()
Particle offset Z.
|
@NotNull Particle |
particle() |
@NotNull ParticleBuilder |
particle(@NotNull Particle particle)
Changes what particle will be sent
|
@Nullable List<Player> |
receivers() |
@NotNull ParticleBuilder |
receivers(@Nullable Collection<Player> receivers) |
@NotNull ParticleBuilder |
receivers(int radius)
Selects all players within a cuboid selection around the particle location, within the
specified bounding box.
|
@NotNull ParticleBuilder |
receivers(int radius,
boolean byDistance)
Selects all players within the specified radius around the particle location.
|
@NotNull ParticleBuilder |
receivers(int xzRadius,
int yRadius)
Selects all players within a cuboid selection around the particle location, within the
specified bounding box.
|
@NotNull ParticleBuilder |
receivers(int xzRadius,
int yRadius,
boolean byDistance)
Selects all players within the specified radius around the particle location.
|
@NotNull ParticleBuilder |
receivers(int xRadius,
int yRadius,
int zRadius)
Selects all players within a cuboid selection around the particle location, within the
specified bounding box.
|
@NotNull ParticleBuilder |
receivers(@Nullable List<Player> receivers) |
@NotNull ParticleBuilder |
receivers(Player... receivers) |
@Nullable Player |
source() |
@NotNull ParticleBuilder |
source(@Nullable Player source)
Sets the source of this particle for visibility concerns (Vanish API)
|
@NotNull ParticleBuilder |
spawn()
Sends the particle to all receiving players (or all).
|
@NotNull public @NotNull ParticleBuilder spawn()
@NotNull public @NotNull ParticleBuilder particle(@NotNull @NotNull Particle particle)
particle
- The particle@Nullable public @Nullable List<Player> receivers()
public boolean hasReceivers()
@NotNull public @NotNull ParticleBuilder allPlayers()
@NotNull public @NotNull ParticleBuilder receivers(@Nullable @Nullable List<Player> receivers)
receivers
- List of players to receive this particle, or null for all players in the
world@NotNull public @NotNull ParticleBuilder receivers(@Nullable @Nullable Collection<Player> receivers)
receivers
- List of players to receive this particle, or null for all players in the
world@NotNull public @NotNull ParticleBuilder receivers(@Nullable Player... receivers)
receivers
- List of players to be receive this particle, or null for all players in the
world@NotNull public @NotNull ParticleBuilder receivers(int radius)
receivers(int,
boolean)
radius
- amount to add on all axis@NotNull public @NotNull ParticleBuilder receivers(int radius, boolean byDistance)
receivers(int, int)
If byDistance is
true, radius is tested by distance in a spherical shaperadius
- amount to add on each axisbyDistance
- true to use a spherical radius, false to use a cuboid@NotNull public @NotNull ParticleBuilder receivers(int xzRadius, int yRadius)
receivers(int, int, boolean)
If you want a more spherical check,
see receivers(int, boolean)
xzRadius
- amount to add on the x/z axisyRadius
- amount to add on the y axis@NotNull public @NotNull ParticleBuilder receivers(int xzRadius, int yRadius, boolean byDistance)
receivers(int, int)
If byDistance is
true, radius is tested by distance on the y plane and on the x/z plane, in a cylinder shape.xzRadius
- amount to add on the x/z axisyRadius
- amount to add on the y axisbyDistance
- true to use a cylinder shape, false to use cuboid@NotNull public @NotNull ParticleBuilder receivers(int xRadius, int yRadius, int zRadius)
receivers(int, int,
boolean)
If you want a more spherical check, see receivers(int, boolean)
xRadius
- amount to add on the x axisyRadius
- amount to add on the y axiszRadius
- amount to add on the z axis@Nullable public @Nullable Player source()
@NotNull public @NotNull ParticleBuilder source(@Nullable @Nullable Player source)
source
- The player who is considered the source@Nullable public @Nullable Location location()
@NotNull public @NotNull ParticleBuilder location(@NotNull @NotNull Location location)
location
- The location of the particle@NotNull public @NotNull ParticleBuilder location(@NotNull @NotNull World world, double x, double y, double z)
world
- World to spawn particle inx
- X locationy
- Y locationz
- Z locationpublic int count()
@NotNull public @NotNull ParticleBuilder count(int count)
count
- Number of particlespublic double offsetX()
public double offsetY()
public double offsetZ()
@NotNull public @NotNull ParticleBuilder offset(double offsetX, double offsetY, double offsetZ)
offsetX
- Particle offset XoffsetY
- Particle offset YoffsetZ
- Particle offset Zpublic double extra()
@NotNull public @NotNull ParticleBuilder extra(double extra)
extra
- the extra particle data@Nullable public <T> T data()
T
- The Particle data type@NotNull public <T> @NotNull ParticleBuilder data(@Nullable T data)
T
- The Particle data typedata
- The new particle data@NotNull public @NotNull ParticleBuilder force(boolean force)
force
- true to force, false for normal@NotNull public @NotNull ParticleBuilder color(@Nullable @Nullable Color color)
color
- the new particle color@NotNull public @NotNull ParticleBuilder color(@Nullable @Nullable Color color, float size)
color
- the new particle colorsize
- the size of the particle@NotNull public @NotNull ParticleBuilder color(int r, int g, int b)
r
- red color componentg
- green color componentb
- blue color componentCopyright © 2021. All rights reserved.