001    package org.bukkit.inventory.meta;
002    
003    import java.util.List;
004    
005    import org.bukkit.FireworkEffect;
006    import org.bukkit.Material;
007    
008    /**
009     * Represents a {@link Material#FIREWORK} and its effects.
010     */
011    public interface FireworkMeta extends ItemMeta {
012    
013        /**
014         * Add another effect to this firework.
015         *
016         * @param effect The firework effect to add
017         * @throws IllegalArgumentException If effect is null
018         */
019        void addEffect(FireworkEffect effect) throws IllegalArgumentException;
020    
021        /**
022         * Add several effects to this firework.
023         *
024         * @param effects The firework effects to add
025         * @throws IllegalArgumentException If effects is null
026         * @throws IllegalArgumentException If any effect is null (may be thrown
027         *     after changes have occurred)
028         */
029        void addEffects(FireworkEffect...effects) throws IllegalArgumentException;
030    
031        /**
032         * Add several firework effects to this firework.
033         *
034         * @param effects An iterable object whose iterator yields the desired
035         *     firework effects
036         * @throws IllegalArgumentException If effects is null
037         * @throws IllegalArgumentException If any effect is null (may be thrown
038         *     after changes have occurred)
039         */
040        void addEffects(Iterable<FireworkEffect> effects) throws IllegalArgumentException;
041    
042        /**
043         * Get the effects in this firework.
044         *
045         * @return An immutable list of the firework effects
046         */
047        List<FireworkEffect> getEffects();
048    
049        /**
050         * Get the number of effects in this firework.
051         *
052         * @return The number of effects
053         */
054        int getEffectsSize();
055    
056        /**
057         * Remove an effect from this firework.
058         *
059         * @param index The index of the effect to remove
060         * @throws IndexOutOfBoundsException If index < 0 or index > {@link
061         *     #getEffectsSize()}
062         */
063        void removeEffect(int index) throws IndexOutOfBoundsException;
064    
065        /**
066         * Remove all effects from this firework.
067         */
068        void clearEffects();
069    
070        /**
071         * Get whether this firework has any effects.
072         *
073         * @return true if it has effects, false if there are no effects
074         */
075        boolean hasEffects();
076    
077        /**
078         * Gets the approximate height the firework will fly.
079         *
080         * @return approximate flight height of the firework.
081         */
082        int getPower();
083    
084        /**
085         * Sets the approximate power of the firework. Each level of power is half
086         * a second of flight time.
087         *
088         * @param power the power of the firework, from 0-128
089         * @throws IllegalArgumentException if height<0 or height>128
090         */
091        void setPower(int power) throws IllegalArgumentException;
092    
093        FireworkMeta clone();
094    }