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
ConstructorsConstructorDescriptionParticleBuilder(ParticleEffect particle) Initializes a newParticleBuilderParticleBuilder(ParticleEffect particle, org.bukkit.Location location) Initializes a newParticleBuilder -
Method Summary
Modifier and TypeMethodDescriptionvoiddisplay()Displays the given particle to all players.voiddisplay(Collection<? extends org.bukkit.entity.Player> players) Displays the given particle to all players in theCollectionvoidDisplay the given particle to online player that match the given filter.voiddisplay(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 theLocationof 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 newParticlePacketwit the given values.
-
Constructor Details
-
ParticleBuilder
Initializes a newParticleBuilder- Parameters:
particle- TheParticleEffectof the builder.location- The location at which the particle should be displayed
-
ParticleBuilder
Initializes a newParticleBuilder- Parameters:
particle- TheParticleEffectof the builder.
-
-
Method Details
-
setLocation
Sets theLocationof the particle.- Parameters:
location- The newLocationof the particle.- Returns:
- the current instance to support building operations
-
setOffsetX
Sets the X offset.- Parameters:
offsetX- The new value of theoffsetXfield- Returns:
- the current instance to support building operations
-
setOffsetY
Sets the Y offset.- Parameters:
offsetY- The new value of theoffsetYfield- Returns:
- the current instance to support building operations
-
setOffset
Sets the offset.- Parameters:
offsetX- The new value of theoffsetXfieldoffsetY- The new value of theoffsetYfieldoffsetZ- The new value of theoffsetZfield- Returns:
- the current instance to support building operations
-
setOffset
Sets the offset.- Parameters:
offset- aVectorcontaining the offset values.- Returns:
- the current instance to support building operations
-
setOffsetZ
Sets the Z offset.- Parameters:
offsetZ- The new value of theoffsetZfield- Returns:
- the current instance to support building operations
-
setSpeed
Sets the speed.- Parameters:
speed- The new value of thespeedfield- Returns:
- the current instance to support building operations
-
setAmount
Sets the amount.- Parameters:
amount- The new value of theamountfield- Returns:
- the current instance to support building operations
-
setParticleData
Sets the particleData.- Parameters:
particleData- The new value of theparticleDatafield- Returns:
- the current instance to support building operations
-
setColor
Sets the color of the particle. Note that particle needs thePropertyType.COLORABLEPropertyType to work.- Parameters:
color- theColorof the particle.- Returns:
- the current instance to support building operations
-
toPacket
Creates a newParticlePacketwit 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- aPredicateto 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.
-