001 package org.bukkit.event.entity; 002 003 import java.util.List; 004 import org.bukkit.PortalType; 005 import org.bukkit.block.BlockState; 006 import org.bukkit.entity.LivingEntity; 007 import org.bukkit.event.Cancellable; 008 import org.bukkit.event.HandlerList; 009 010 /** 011 * Thrown when a Living Entity creates a portal in a world. 012 */ 013 public class EntityCreatePortalEvent extends EntityEvent implements Cancellable { 014 private static final HandlerList handlers = new HandlerList(); 015 private final List<BlockState> blocks; 016 private boolean cancelled = false; 017 private PortalType type = PortalType.CUSTOM; 018 019 public EntityCreatePortalEvent(final LivingEntity what, final List<BlockState> blocks, final PortalType type) { 020 super(what); 021 022 this.blocks = blocks; 023 this.type = type; 024 } 025 026 @Override 027 public LivingEntity getEntity() { 028 return (LivingEntity) entity; 029 } 030 031 /** 032 * Gets a list of all blocks associated with the portal. 033 * 034 * @return List of blocks that will be changed. 035 */ 036 public List<BlockState> getBlocks() { 037 return blocks; 038 } 039 040 public boolean isCancelled() { 041 return cancelled; 042 } 043 044 public void setCancelled(boolean cancel) { 045 this.cancelled = cancel; 046 } 047 048 /** 049 * Gets the type of portal that is trying to be created. 050 * 051 * @return Type of portal. 052 */ 053 public PortalType getPortalType() { 054 return type; 055 } 056 057 @Override 058 public HandlerList getHandlers() { 059 return handlers; 060 } 061 062 public static HandlerList getHandlerList() { 063 return handlers; 064 } 065 }