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