Package org.bukkit
Class FireworkEffect.Builder
java.lang.Object
org.bukkit.FireworkEffect.Builder
- Enclosing class:
- FireworkEffect
public static final class FireworkEffect.Builder
extends java.lang.Object
This is a builder for FireworkEffects.
- See Also:
FireworkEffect.builder()
-
Method Summary
Modifier and Type Method Description FireworkEffectbuild()Create aFireworkEffectfrom the current contents of this builder.FireworkEffect.Builderflicker(boolean flicker)Set whether the firework effect should flicker.FireworkEffect.Buildertrail(boolean trail)Set whether the firework effect should have a trail.FireworkEffect.Builderwith(FireworkEffect.Type type)Specify the type of the firework effect.FireworkEffect.BuilderwithColor(java.lang.Iterable<?> colors)Add several primary colors to the firework effect.FireworkEffect.BuilderwithColor(Color color)Add a primary color to the firework effect.FireworkEffect.BuilderwithColor(Color... colors)Add several primary colors to the firework effect.FireworkEffect.BuilderwithFade(java.lang.Iterable<?> colors)Add several fade colors to the firework effect.FireworkEffect.BuilderwithFade(Color color)Add a fade color to the firework effect.FireworkEffect.BuilderwithFade(Color... colors)Add several fade colors to the firework effect.FireworkEffect.BuilderwithFlicker()Add a flicker to the firework effect.FireworkEffect.BuilderwithTrail()Add a trail to the firework effect.
-
Method Details
-
with
public FireworkEffect.Builder with(FireworkEffect.Type type) throws java.lang.IllegalArgumentExceptionSpecify the type of the firework effect.- Parameters:
type- The effect type- Returns:
- This object, for chaining
- Throws:
java.lang.IllegalArgumentException- If type is null
-
withFlicker
Add a flicker to the firework effect.- Returns:
- This object, for chaining
-
flicker
Set whether the firework effect should flicker.- Parameters:
flicker- true if it should flicker, false if not- Returns:
- This object, for chaining
-
withTrail
Add a trail to the firework effect.- Returns:
- This object, for chaining
-
trail
Set whether the firework effect should have a trail.- Parameters:
trail- true if it should have a trail, false for no trail- Returns:
- This object, for chaining
-
withColor
Add a primary color to the firework effect.- Parameters:
color- The color to add- Returns:
- This object, for chaining
- Throws:
java.lang.IllegalArgumentException- If color is null
-
withColor
Add several primary colors to the firework effect.- Parameters:
colors- The colors to add- Returns:
- This object, for chaining
- Throws:
java.lang.IllegalArgumentException- If colors is nulljava.lang.IllegalArgumentException- If any color is null (may be thrown after changes have occurred)
-
withColor
public FireworkEffect.Builder withColor(java.lang.Iterable<?> colors) throws java.lang.IllegalArgumentExceptionAdd several primary colors to the firework effect.- Parameters:
colors- An iterable object whose iterator yields the desired colors- Returns:
- This object, for chaining
- Throws:
java.lang.IllegalArgumentException- If colors is nulljava.lang.IllegalArgumentException- If any color is null (may be thrown after changes have occurred)
-
withFade
Add a fade color to the firework effect.- Parameters:
color- The color to add- Returns:
- This object, for chaining
- Throws:
java.lang.IllegalArgumentException- If colors is nulljava.lang.IllegalArgumentException- If any color is null (may be thrown after changes have occurred)
-
withFade
Add several fade colors to the firework effect.- Parameters:
colors- The colors to add- Returns:
- This object, for chaining
- Throws:
java.lang.IllegalArgumentException- If colors is nulljava.lang.IllegalArgumentException- If any color is null (may be thrown after changes have occurred)
-
withFade
public FireworkEffect.Builder withFade(java.lang.Iterable<?> colors) throws java.lang.IllegalArgumentExceptionAdd several fade colors to the firework effect.- Parameters:
colors- An iterable object whose iterator yields the desired colors- Returns:
- This object, for chaining
- Throws:
java.lang.IllegalArgumentException- If colors is nulljava.lang.IllegalArgumentException- If any color is null (may be thrown after changes have occurred)
-
build
Create aFireworkEffectfrom the current contents of this builder.To successfully build, you must have specified at least one color.
- Returns:
- The representative firework effect
-