Package xyz.xenondevs.particle
Class ParticleBuilder
java.lang.Object
xyz.xenondevs.particle.ParticleBuilder
A builder for particle packets.
- Since:
- 24/01/2020
- Author:
- ByteZ
-
Constructor Summary
ConstructorDescriptionParticleBuilder
(ParticleEffect particle) Initializes a newParticleBuilder
ParticleBuilder
(ParticleEffect particle, org.bukkit.Location location) Initializes a newParticleBuilder
-
Method Summary
Modifier and TypeMethodDescriptionvoid
display()
Displays the given particle to all players.void
display
(Collection<? extends org.bukkit.entity.Player> players) Displays the given particle to all players in theCollection
void
Display the given particle to online player that match the given filter.void
display
(org.bukkit.entity.Player... players) Displays the given particle to the players in the array.setAmount
(int amount) Sets the amount.Sets the color of the particle.setLocation
(org.bukkit.Location location) Sets theLocation
of the particle.setOffset
(float offsetX, float offsetY, float offsetZ) Sets the offset.setOffset
(org.bukkit.util.Vector offset) Sets the offset.setOffsetX
(float offsetX) Sets the X offset.setOffsetY
(float offsetY) Sets the Y offset.setOffsetZ
(float offsetZ) Sets the Z offset.setParticleData
(ParticleData particleData) Sets the particleData.setSpeed
(float speed) Sets the speed.toPacket()
Creates a newParticlePacket
wit the given values.
-
Constructor Details
-
ParticleBuilder
Initializes a newParticleBuilder
- Parameters:
particle
- TheParticleEffect
of the builder.location
- The location at which the particle should be displayed
-
ParticleBuilder
Initializes a newParticleBuilder
- Parameters:
particle
- TheParticleEffect
of the builder.
-
-
Method Details
-
setLocation
Sets theLocation
of the particle.- Parameters:
location
- The newLocation
of the particle.- Returns:
- the current instance to support building operations
-
setOffsetX
Sets the X offset.- Parameters:
offsetX
- The new value of theoffsetX
field- Returns:
- the current instance to support building operations
-
setOffsetY
Sets the Y offset.- Parameters:
offsetY
- The new value of theoffsetY
field- Returns:
- the current instance to support building operations
-
setOffset
Sets the offset.- Parameters:
offsetX
- The new value of theoffsetX
fieldoffsetY
- The new value of theoffsetY
fieldoffsetZ
- The new value of theoffsetZ
field- Returns:
- the current instance to support building operations
-
setOffset
Sets the offset.- Parameters:
offset
- aVector
containing the offset values.- Returns:
- the current instance to support building operations
-
setOffsetZ
Sets the Z offset.- Parameters:
offsetZ
- The new value of theoffsetZ
field- Returns:
- the current instance to support building operations
-
setSpeed
Sets the speed.- Parameters:
speed
- The new value of thespeed
field- Returns:
- the current instance to support building operations
-
setAmount
Sets the amount.- Parameters:
amount
- The new value of theamount
field- Returns:
- the current instance to support building operations
-
setParticleData
Sets the particleData.- Parameters:
particleData
- The new value of theparticleData
field- Returns:
- the current instance to support building operations
-
setColor
Sets the color of the particle. Note that particle needs thePropertyType.COLORABLE
PropertyType to work.- Parameters:
color
- theColor
of the particle.- Returns:
- the current instance to support building operations
-
toPacket
Creates a newParticlePacket
wit the given values.- Returns:
- the new
ParticlePacket
- Throws:
IllegalStateException
- if the location field isn't set yet.
-
display
public void display()Displays the given particle to all players. -
display
public void display(org.bukkit.entity.Player... players) Displays the given particle to the players in the array.- Parameters:
players
- The players that should see the particle.
-
display
Display the given particle to online player that match the given filter.- Parameters:
filter
- aPredicate
to filter out specificPlayers
.
-
display
Displays the given particle to all players in theCollection
- Parameters:
players
- a list of players that should receive the particle packet.
-