Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
EntityExplodeEvent.java
1 package org.bukkit.event.entity;
2 
3 import org.bukkit.Location;
4 import org.bukkit.block.Block;
5 import org.bukkit.entity.Entity;
8 
9 import java.util.List;
10 
11 /**
12  * Called when an entity explodes
13  */
14 public class EntityExplodeEvent extends EntityEvent implements Cancellable {
15  private static final HandlerList handlers = new HandlerList();
16  private boolean cancel;
17  private final Location location;
18  private final List<Block> blocks;
19  private float yield;
20 
21  public EntityExplodeEvent(final Entity what, final Location location, final List<Block> blocks, final float yield) {
22  super(what);
23  this.location = location;
24  this.blocks = blocks;
25  this.yield = yield;
26  this.cancel = false;
27  }
28 
29  public boolean isCancelled() {
30  return cancel;
31  }
32 
33  public void setCancelled(boolean cancel) {
34  this.cancel = cancel;
35  }
36 
37  /**
38  * Returns the list of blocks that would have been removed or were removed
39  * from the explosion event.
40  *
41  * @return All blown-up blocks
42  */
43  public List<Block> blockList() {
44  return blocks;
45  }
46 
47  /**
48  * Returns the location where the explosion happened.
49  * <p>
50  * It is not possible to get this value from the Entity as the Entity no
51  * longer exists in the world.
52  *
53  * @return The location of the explosion
54  */
55  public Location getLocation() {
56  return location;
57  }
58 
59  /**
60  * Returns the percentage of blocks to drop from this explosion
61  *
62  * @return The yield.
63  */
64  public float getYield() {
65  return yield;
66  }
67 
68  /**
69  * Sets the percentage of blocks to drop from this explosion
70  *
71  * @param yield The new yield percentage
72  */
73  public void setYield(float yield) {
74  this.yield = yield;
75  }
76 
77  @Override
78  public HandlerList getHandlers() {
79  return handlers;
80  }
81 
82  public static HandlerList getHandlerList() {
83  return handlers;
84  }
85 }