Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
EntityCreatePortalEvent.java
1 package org.bukkit.event.entity;
2 
3 import java.util.List;
4 import org.bukkit.PortalType;
9 
10 /**
11  * Thrown when a Living Entity creates a portal in a world.
12  */
13 public class EntityCreatePortalEvent extends EntityEvent implements Cancellable {
14  private static final HandlerList handlers = new HandlerList();
15  private final List<BlockState> blocks;
16  private boolean cancelled = false;
17  private PortalType type = PortalType.CUSTOM;
18 
19  public EntityCreatePortalEvent(final LivingEntity what, final List<BlockState> blocks, final PortalType type) {
20  super(what);
21 
22  this.blocks = blocks;
23  this.type = type;
24  }
25 
26  @Override
27  public LivingEntity getEntity() {
28  return (LivingEntity) entity;
29  }
30 
31  /**
32  * Gets a list of all blocks associated with the portal.
33  *
34  * @return List of blocks that will be changed.
35  */
36  public List<BlockState> getBlocks() {
37  return blocks;
38  }
39 
40  public boolean isCancelled() {
41  return cancelled;
42  }
43 
44  public void setCancelled(boolean cancel) {
45  this.cancelled = cancel;
46  }
47 
48  /**
49  * Gets the type of portal that is trying to be created.
50  *
51  * @return Type of portal.
52  */
54  return type;
55  }
56 
57  @Override
58  public HandlerList getHandlers() {
59  return handlers;
60  }
61 
62  public static HandlerList getHandlerList() {
63  return handlers;
64  }
65 }