Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package org.bukkit.event.entity;
2
3import org.bukkit.Location;
4import org.bukkit.block.Block;
5import org.bukkit.entity.Entity;
6import org.bukkit.event.Cancellable;
7
8import java.util.List;
9
10/**
11 * Called when an entity explodes
12 */
13public class EntityExplodeEvent extends EntityEvent implements Cancellable {
14 private boolean cancel;
15 private Location location;
16 private List<Block> blocks;
17 private float yield = 0.3F;
18
19 public EntityExplodeEvent(Entity what, Location location, List<Block> blocks) {
20 super(Type.ENTITY_EXPLODE, what);
21 this.location = location;
22 this.cancel = false;
23 this.blocks = blocks;
24 }
25
26 public boolean isCancelled() {
27 return cancel;
28 }
29
30 public void setCancelled(boolean cancel) {
31 this.cancel = cancel;
32 }
33
34 /**
35 * Returns the list of blocks that would have been removed or were
36 * removed from the explosion event.
37 */
38 public List<Block> blockList() {
39 return blocks;
40 }
41
42 /**
43 * Returns the location where the explosion happened.
44 * It is not possible to get this value from the Entity as
45 * the Entity no longer exists in the world.
46 */
47 public Location getLocation() {
48 return location;
49 }
50
51 /**
52 * Returns the percentage of blocks to drop from this explosion
53 *
54 * @return
55 */
56 public float getYield() {
57 return yield;
58 }
59
60 /**
61 * Sets the percentage of blocks to drop from this explosion
62 */
63 public void setYield(float yield) {
64 this.yield = yield;
65 }
66}