001 package org.bukkit.event.entity;
002
003 import org.bukkit.entity.Slime;
004 import org.bukkit.event.Cancellable;
005 import org.bukkit.event.HandlerList;
006
007 /**
008 * Called when a Slime splits into smaller Slimes upon death
009 */
010 public class SlimeSplitEvent extends EntityEvent implements Cancellable {
011 private static final HandlerList handlers = new HandlerList();
012 private boolean cancel = false;
013 private int count;
014
015 public SlimeSplitEvent(final Slime slime, final int count) {
016 super(slime);
017 this.count = count;
018 }
019
020 public boolean isCancelled() {
021 return cancel;
022 }
023
024 public void setCancelled(boolean cancel) {
025 this.cancel = cancel;
026 }
027
028 @Override
029 public Slime getEntity() {
030 return (Slime) entity;
031 }
032
033 /**
034 * Gets the amount of smaller slimes to spawn
035 *
036 * @return the amount of slimes to spawn
037 */
038 public int getCount() {
039 return count;
040 }
041
042 /**
043 * Sets how many smaller slimes will spawn on the split
044 *
045 * @param count the amount of slimes to spawn
046 */
047 public void setCount(int count) {
048 this.count = count;
049 }
050
051 @Override
052 public HandlerList getHandlers() {
053 return handlers;
054 }
055
056 public static HandlerList getHandlerList() {
057 return handlers;
058 }
059 }