Class ParticleBuilder

java.lang.Object
xyz.xenondevs.particle.ParticleBuilder

public class ParticleBuilder extends Object
A builder for particle packets.
Since:
24/01/2020
Author:
ByteZ
  • Constructor Details

  • Method Details

    • setLocation

      public ParticleBuilder setLocation(org.bukkit.Location location)
      Sets the Location of the particle.
      Parameters:
      location - The new Location of the particle.
      Returns:
      the current instance to support building operations
    • setOffsetX

      public ParticleBuilder setOffsetX(float offsetX)
      Sets the X offset.
      Parameters:
      offsetX - The new value of the offsetX field
      Returns:
      the current instance to support building operations
    • setOffsetY

      public ParticleBuilder setOffsetY(float offsetY)
      Sets the Y offset.
      Parameters:
      offsetY - The new value of the offsetY field
      Returns:
      the current instance to support building operations
    • setOffset

      public ParticleBuilder setOffset(float offsetX, float offsetY, float offsetZ)
      Sets the offset.
      Parameters:
      offsetX - The new value of the offsetX field
      offsetY - The new value of the offsetY field
      offsetZ - The new value of the offsetZ field
      Returns:
      the current instance to support building operations
    • setOffset

      public ParticleBuilder setOffset(org.bukkit.util.Vector offset)
      Sets the offset.
      Parameters:
      offset - a Vector containing the offset values.
      Returns:
      the current instance to support building operations
    • setOffsetZ

      public ParticleBuilder setOffsetZ(float offsetZ)
      Sets the Z offset.
      Parameters:
      offsetZ - The new value of the offsetZ field
      Returns:
      the current instance to support building operations
    • setSpeed

      public ParticleBuilder setSpeed(float speed)
      Sets the speed.
      Parameters:
      speed - The new value of the speed field
      Returns:
      the current instance to support building operations
    • setAmount

      public ParticleBuilder setAmount(int amount)
      Sets the amount.
      Parameters:
      amount - The new value of the amount field
      Returns:
      the current instance to support building operations
    • setParticleData

      public ParticleBuilder setParticleData(ParticleData particleData)
      Sets the particleData.
      Parameters:
      particleData - The new value of the particleData field
      Returns:
      the current instance to support building operations
    • setColor

      public ParticleBuilder setColor(Color color)
      Sets the color of the particle. Note that particle needs the PropertyType.COLORABLE PropertyType to work.
      Parameters:
      color - the Color of the particle.
      Returns:
      the current instance to support building operations
    • toPacket

      public Object toPacket()
      Creates a new ParticlePacket 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

      public void display(Predicate<org.bukkit.entity.Player> filter)
      Display the given particle to online player that match the given filter.
      Parameters:
      filter - a Predicate to filter out specific Players.
    • display

      public void display(Collection<? extends org.bukkit.entity.Player> players)
      Displays the given particle to all players in the Collection
      Parameters:
      players - a list of players that should receive the particle packet.