001    package org.bukkit.event.entity;
002    
003    import org.bukkit.entity.ThrownExpBottle;
004    import org.bukkit.event.HandlerList;
005    
006    /**
007     * Called when a ThrownExpBottle hits and releases experience.
008     */
009    public class ExpBottleEvent extends ProjectileHitEvent {
010        private static final HandlerList handlers = new HandlerList();
011        private int exp;
012        private boolean showEffect = true;
013    
014        public ExpBottleEvent(final ThrownExpBottle bottle, final int exp) {
015            super(bottle);
016            this.exp = exp;
017        }
018    
019        @Override
020        public ThrownExpBottle getEntity() {
021            return (ThrownExpBottle) entity;
022        }
023    
024        /**
025         * This method indicates if the particle effect should be shown.
026         *
027         * @return true if the effect will be shown, false otherwise
028         */
029        public boolean getShowEffect() {
030            return this.showEffect;
031        }
032    
033        /**
034         * This method sets if the particle effect will be shown.
035         * <p>
036         * This does not change the experience created.
037         *
038         * @param showEffect true indicates the effect will be shown, false
039         *     indicates no effect will be shown
040         */
041        public void setShowEffect(final boolean showEffect) {
042            this.showEffect = showEffect;
043        }
044    
045        /**
046         * This method retrieves the amount of experience to be created.
047         * <p>
048         * The number indicates a total amount to be divided into orbs.
049         *
050         * @return the total amount of experience to be created
051         */
052        public int getExperience() {
053            return exp;
054        }
055    
056        /**
057         * This method sets the amount of experience to be created.
058         * <p>
059         * The number indicates a total amount to be divided into orbs.
060         *
061         * @param exp the total amount of experience to be created
062         */
063        public void setExperience(final int exp) {
064            this.exp = exp;
065        }
066    
067        @Override
068        public HandlerList getHandlers() {
069            return handlers;
070        }
071    
072        public static HandlerList getHandlerList() {
073            return handlers;
074        }
075    }